Top Description Inners Fields Constructors Methods
net.sf.ehcache.store

public Class BruteForceSearchManager

extends Object
implements SearchManager
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.search.impl.SearchManager
Imports
net.sf.ehcache.CacheException, .Ehcache, .Element, net.sf.ehcache.config.ConfigurationHelper, .SearchAttribute, .Searchable, net.sf.ehcache.search.Attribute, .Results, .SearchException, net.sf.ehcache.search.aggregator.AggregatorInstance, net.sf.ehcache.search.attribute.AttributeExtractor, .AttributeExtractorException, .AttributeType, .DynamicAttributesExtractor, net.sf.ehcache.search.expression.Criteria, net.sf.ehcache.search.impl.AggregateOnlyResult, .BaseResult, .DynamicSearchChecker, .GroupedResultImpl, .OrderComparator, .ResultImpl, .ResultsImpl, .SearchManager, net.sf.ehcache.transaction.SoftLockID, java.util.ArrayList, .Collection, .Collections, .HashMap, .HashSet, .LinkedList, .List, .Map, .Set, java.util.concurrent.CopyOnWriteArraySet

Brute force search implementation
Author
teck

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
BruteForceSearchManager.ResultHolder

Concrete search result with relevant inputs to aggregate functions (if any)

Field Summary

Modifier and TypeField and Description
private BruteForceSource
private final Ehcache
private static final Object[]
private final Set<Attribute<T>>
searchAttributes

account for all search attributes

Constructor Summary

AccessConstructor and Description
public
BruteForceSearchManager(Ehcache cache)

Create a BruteForceSearchManager

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addSearchAttributes(Set<Attribute<?>>
the search attributes to add
attributeSet
)

Add search attributes

public void
clear(String
cache name to clear
cacheName
,
int
segment of cache
segmentId
)

Implements net.sf.ehcache.search.impl.SearchManager.clear.

Clear a segment of the given cache
public Results
executeQuery(StoreQuery
query to execute
query
,
Map<String, AttributeExtractor>
defined attribute extractors for the cache
extractors
,
DynamicAttributesExtractor
dynamic attribute extractor (if any)
dynIndexer
)

Implements net.sf.ehcache.search.impl.SearchManager.executeQuery.

Execute a query against the given cache
private Map<String, Object>
getAttributeValues(Set<Attribute<?>> attributes, Map<String, AttributeExtractor> extractors, Element element)

private Map<String, AttributeExtractor>
public Set<Attribute<T>>
getSearchAttributes(String cacheName)

Implements net.sf.ehcache.search.impl.SearchManager.getSearchAttributes.

Returns all known search attributes for cache with given name
private Object[]
public void
put(String
cache name
cacheName
,
int
segment of cache
segmentId
,
Element
element being added to cache
element
,
byte[]
serialized form of the element key
key
,
Map<String, AttributeExtractor>
the attribute extractors for the cache
extractors
,
DynamicAttributesExtractor
dynamic attribute extractor (if any)
dynamicIndexer
)

Implements net.sf.ehcache.search.impl.SearchManager.put.

Notify an element added to a segment of a given cache
public void
remove(String
cache name
cacheName
,
Object
unique key of element
key
,
int
segment of cache
segmentId
,
boolean
true if called as a result of actual storage engine removal (as opposed to move), false otherwise
isRemoval
)

Implements net.sf.ehcache.search.impl.SearchManager.remove.

Notify an element removed from a segment of a given cache
public void
setBruteForceSource(BruteForceSource
the source
bruteForceSource
)

Sets the BruteForceSource to be used for search

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bruteForceSourceback to summary
private BruteForceSource bruteForceSource
cacheback to summary
private final Ehcache cache
EMPTY_OBJECT_ARRAYback to summary
private static final Object[] EMPTY_OBJECT_ARRAY
searchAttributesback to summary
private final Set<Attribute<T>> searchAttributes

account for all search attributes

Constructor Detail

BruteForceSearchManagerback to summary
public BruteForceSearchManager(Ehcache cache)

Create a BruteForceSearchManager

Method Detail

addSearchAttributesback to summary
pack-priv void addSearchAttributes(Set<Attribute<?>> attributeSet)

Add search attributes

Parameters
attributeSet:Set<Attribute<?>>

the search attributes to add

clearback to summary
public void clear(String cacheName, int segmentId)

Implements net.sf.ehcache.search.impl.SearchManager.clear.

Doc from net.sf.ehcache.search.impl.SearchManager.clear.

Clear a segment of the given cache

Parameters
cacheName:String

cache name to clear

segmentId:int

segment of cache

Annotations
@Override
executeQueryback to summary
public Results executeQuery(StoreQuery query, Map<String, AttributeExtractor> extractors, DynamicAttributesExtractor dynIndexer)

Implements net.sf.ehcache.search.impl.SearchManager.executeQuery.

Doc from net.sf.ehcache.search.impl.SearchManager.executeQuery.

Execute a query against the given cache

Parameters
query:StoreQuery

query to execute

extractors:Map<String, AttributeExtractor>

defined attribute extractors for the cache

dynIndexer:DynamicAttributesExtractor

dynamic attribute extractor (if any)

Returns:Results

search results

Annotations
@Override
getAttributeValuesback to summary
private Map<String, Object> getAttributeValues(Set<Attribute<?>> attributes, Map<String, AttributeExtractor> extractors, Element element)
getCombinedExtractorsback to summary
private Map<String, AttributeExtractor> getCombinedExtractors(Map<String, AttributeExtractor> configExtractors, DynamicAttributesExtractor dynIndexer, Element element)
getSearchAttributesback to summary
public Set<Attribute<T>> getSearchAttributes(String cacheName)

Implements net.sf.ehcache.search.impl.SearchManager.getSearchAttributes.

Doc from net.sf.ehcache.search.impl.SearchManager.getSearchAttributes.

Returns all known search attributes for cache with given name

Annotations
@Override
getSortAttributesback to summary
private Object[] getSortAttributes(StoreQuery query, Map<String, AttributeExtractor> extractors, Element element)
putback to summary
public void put(String cacheName, int segmentId, Element element, byte[] key, Map<String, AttributeExtractor> extractors, DynamicAttributesExtractor dynamicIndexer)

Implements net.sf.ehcache.search.impl.SearchManager.put.

Doc from net.sf.ehcache.search.impl.SearchManager.put.

Notify an element added to a segment of a given cache

Parameters
cacheName:String

cache name

segmentId:int

segment of cache

element:Element

element being added to cache

key:byte[]

serialized form of the element key

extractors:Map<String, AttributeExtractor>

the attribute extractors for the cache

dynamicIndexer:DynamicAttributesExtractor

dynamic attribute extractor (if any)

Annotations
@Override
removeback to summary
public void remove(String cacheName, Object key, int segmentId, boolean isRemoval)

Implements net.sf.ehcache.search.impl.SearchManager.remove.

Doc from net.sf.ehcache.search.impl.SearchManager.remove.

Notify an element removed from a segment of a given cache

Parameters
cacheName:String

cache name

key:Object

unique key of element

segmentId:int

segment of cache

isRemoval:boolean

true if called as a result of actual storage engine removal (as opposed to move), false otherwise

Annotations
@Override
setBruteForceSourceback to summary
public void setBruteForceSource(BruteForceSource bruteForceSource)

Sets the BruteForceSource to be used for search

Parameters
bruteForceSource:BruteForceSource

the source

setResultAggregatorsback to summary
private void setResultAggregators(List<AggregatorInstance<?>> aggregators, BaseResult result)
net.sf.ehcache.store back to summary

private final Class BruteForceSearchManager.ResultHolder

extends Object
implements Comparable<BruteForceSearchManager.ResultHolder>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

Concrete search result with relevant inputs to aggregate functions (if any)

Field Summary

Modifier and TypeField and Description
private final List<Object>
private final OrderComparator<BaseResult>
private final BaseResult

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(BruteForceSearchManager.ResultHolder
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aggregatorInputsback to summary
private final List<Object> aggregatorInputs
compback to summary
private final OrderComparator<BaseResult> comp
resultback to summary
private final BaseResult result

Constructor Detail

ResultHolderback to summary
private ResultHolder(BaseResult res, List<Object> values, OrderComparator<BaseResult> cmp)

Method Detail

compareToback to summary
public int compareTo(BruteForceSearchManager.ResultHolder other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:BruteForceSearchManager.ResultHolder

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override