org.opends.server.extensions
Class EntryCacheCommon

java.lang.Object
  extended by org.opends.server.extensions.EntryCacheCommon

public class EntryCacheCommon
extends java.lang.Object

This class provides some common tools to all entry cache implementations.


Nested Class Summary
 class EntryCacheCommon.ConfigErrorHandler
          Error handler used by local methods to report configuration error.
static class EntryCacheCommon.ConfigPhase
          Configuration phases.
 
Constructor Summary
EntryCacheCommon()
           
 
Method Summary
static EntryCacheCommon.ConfigErrorHandler getConfigErrorHandler(EntryCacheCommon.ConfigPhase configPhase, java.util.List<Message> unacceptableReasons, java.util.ArrayList<Message> errorMessages)
          Create a new error handler.
static java.util.HashSet<SearchFilter> getFilters(java.util.SortedSet<java.lang.String> filters, MessageDescriptor.Arg3<java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence> decodeErrorMsg, EntryCacheCommon.ConfigErrorHandler errorHandler, DN configEntryDN)
          Reads a list of string filters and convert it to a list of search filters.
static java.util.ArrayList<Attribute> getGenericMonitorData(java.lang.Long cacheHits, java.lang.Long cacheMisses, java.lang.Long cacheSize, java.lang.Long maxCacheSize, java.lang.Long cacheCount, java.lang.Long maxCacheCount)
          Constructs a set of generic attributes containing entry cache monitor data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntryCacheCommon

public EntryCacheCommon()
Method Detail

getFilters

public static java.util.HashSet<SearchFilter> getFilters(java.util.SortedSet<java.lang.String> filters,
                                                         MessageDescriptor.Arg3<java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence> decodeErrorMsg,
                                                         EntryCacheCommon.ConfigErrorHandler errorHandler,
                                                         DN configEntryDN)
Reads a list of string filters and convert it to a list of search filters.

Parameters:
filters - the list of string filter to convert to search filters
decodeErrorMsg - the error message ID to use in case of error
errorHandler - error handler to report filter decoding errors on
configEntryDN - the entry cache configuration DN
Returns:
the set of search filters

getConfigErrorHandler

public static EntryCacheCommon.ConfigErrorHandler getConfigErrorHandler(EntryCacheCommon.ConfigPhase configPhase,
                                                                        java.util.List<Message> unacceptableReasons,
                                                                        java.util.ArrayList<Message> errorMessages)
Create a new error handler.

Parameters:
configPhase - the configuration phase for which the error handler is used
unacceptableReasons - the reasons why the configuration cannot be applied (during PHASE_ACCEPTABLE phase)
errorMessages - the errors found when applying a new configuration (during PHASE_APPLY phase)
Returns:
a new configuration error handler

getGenericMonitorData

public static java.util.ArrayList<Attribute> getGenericMonitorData(java.lang.Long cacheHits,
                                                                   java.lang.Long cacheMisses,
                                                                   java.lang.Long cacheSize,
                                                                   java.lang.Long maxCacheSize,
                                                                   java.lang.Long cacheCount,
                                                                   java.lang.Long maxCacheCount)
Constructs a set of generic attributes containing entry cache monitor data. Note that null can be passed in place of any argument to denote the argument is omitted, such is when no state data of a given kind is available or can be provided.

Parameters:
cacheHits - number of cache hits.
cacheMisses - number of cache misses.
cacheSize - size of the current cache, in bytes.
maxCacheSize - maximum allowed cache size, in bytes.
cacheCount - number of entries stored in the cache.
maxCacheCount - maximum number of cache entries allowed.
Returns:
A set of generic attributes containing monitor data.