Spring Data for VMware GemFire
Class Interest<K>
java.lang.Object
org.springframework.data.gemfire.client.Interest<K>
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
KeyInterest,RegexInterest
public class Interest<K>
extends Object
implements org.springframework.beans.factory.InitializingBean
The Interest class holds details for registering a client interest.
- Since:
- 1.0.0
- See Also:
-
PatternInterestResultPolicyInitializingBeanConstants
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final booleanprotected static final booleanprotected final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance of non-durableInterestinitialized with the given key to register interest in, using theInterestResultPolicy.DEFAULTto initialize the client cache and receiving values by default.Constructs an instance of non-durableInterestinitialized with the given key to register interest in, the givenInterestResultPolicyused to initialize the client cache, receiving values by default.Constructs an instance ofInterestinitialized with the given key to register interest in, the givenInterestResultPolicyused to initialize the client cache, the given boolean value to indicate whether interest registration should be durable, receiving values by default.Interest(K key, org.apache.geode.cache.InterestResultPolicy policy, boolean durable, boolean receiveValues) Constructs an instance ofInterestinitialized with the given key to register interest in, the givenInterestResultPolicyused to initialize the client cache and the given boolean values indicating whether interest registration should be durable and whether to receive values during notifications. -
Method Summary
Modifier and TypeMethodDescriptionvoidasType(Interest.Type type) Builder method to specify the type of interest registration.protected booleanDetermines whether the givenStringvalue contains at least 1 special character.getKey()Returns the key on which interest is registered.org.apache.geode.cache.InterestResultPolicyReturns theInterestResultPolicyused when interest is registered and determines whether KEYS, KEYS_VALUES or nothing (NONE) is initially fetched on initial registration.getType()Returns the type of interest registration (e.g.protected booleanisAlphaNumericWhitespace(char character) Determines whether the givencharacteris an alphanumeric or whitespace character.booleanDetermines whether the interest registration is durable and persists between cache client sessions.booleanDetermines whether thisInterestis a KEY interest registration.protected booleanisNotAlphaNumericWhitespace(char character) Determines whether the givencharacteris a special character (non-alphanumeric, non-whitespace).booleanReturns the type of values received by the listener.booleanDetermines whether thisInterestis a REGEX interest registration.protected booleanDetermines whether the givenkeyis a Regular Expression (Regex).protected booleanisRegularExpression(String value) Determines whether the givenkeyis a Regular Expression (Regex).Builder method to mark thisInterestas durable.static <K> InterestnewInterest(K key) Factory method to construct a new instance ofInterestinitialized with the given key.receivesValues(boolean receiveValues) Builder method to set whether the interest event notifications will receive values along with keys.protected Interest.TyperesolveType(Interest.Type type) Attempts to resolve theInterest.Typebased on the configuredgetKey().voidsetDurable(boolean durable) Sets whether interest registration is durable and persists between cache client sessions.voidSets the key on which interest is registered.voidSets the initialInterestResultPolicyused when interest is first registered and determines whether KEYS, KEYS_VALUE or nothing (NONE) is initially fetched.voidsetReceiveValues(boolean receiveValues) Switches between the different entities received by the listener.voidsetType(Interest.Type type) Set the type of interest registration (e.g.toString()usingPolicy(org.apache.geode.cache.InterestResultPolicy policy) Builder method to set theInterestResultPolicyused to initialize the cache.Builder method to express the key of interest.
-
Field Details
-
ALL_KEYS
- See Also:
-
DEFAULT_DURABLE
protected static final boolean DEFAULT_DURABLE- See Also:
-
DEFAULT_RECEIVE_VALUES
protected static final boolean DEFAULT_RECEIVE_VALUES- See Also:
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Details
-
Interest
Constructs an instance of non-durableInterestinitialized with the given key to register interest in, using theInterestResultPolicy.DEFAULTto initialize the client cache and receiving values by default.- Parameters:
key- key(s) of interest.- See Also:
-
Interest
Constructs an instance of non-durableInterestinitialized with the given key to register interest in, the givenInterestResultPolicyused to initialize the client cache, receiving values by default.- Parameters:
key- key(s) of interest.policy- initialInterestResultPolicyused to initialize the client cache.- See Also:
-
Interest
Constructs an instance ofInterestinitialized with the given key to register interest in, the givenInterestResultPolicyused to initialize the client cache, the given boolean value to indicate whether interest registration should be durable, receiving values by default.- Parameters:
key- key(s) of interest.policy- initialInterestResultPolicyused to initialize the client cache.durable- boolean value to indicate whether the interest registration should be durable.- See Also:
-
Interest
public Interest(K key, org.apache.geode.cache.InterestResultPolicy policy, boolean durable, boolean receiveValues) Constructs an instance ofInterestinitialized with the given key to register interest in, the givenInterestResultPolicyused to initialize the client cache and the given boolean values indicating whether interest registration should be durable and whether to receive values during notifications.- Parameters:
key- key(s) of interest.policy- initialInterestResultPolicyused to initialize the client cache.durable- boolean value to indicate whether the interest registration should be durable.receiveValues- boolean value to indicate whether to receive value in notifications.- See Also:
-
-
Method Details
-
newInterest
Factory method to construct a new instance ofInterestinitialized with the given key. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
resolveType
Attempts to resolve theInterest.Typebased on the configuredgetKey().- Parameters:
type- providedInterest.Typeused if non-null.- Returns:
- the resolved
Interest.Type. - See Also:
-
isRegularExpression
Determines whether the givenkeyis a Regular Expression (Regex). If the givenkeyis "ALL_KEYS", aListor only contains letters, numbers and spaces, then thekeyis not considered a Regular Expression by GemFire, and can be handled with normal interest registration usingRegion.registerInterest(Object). -
isRegularExpression
Determines whether the givenkeyis a Regular Expression (Regex). If the givenvaluecontains at least 1 special character (e.g. *) and can be compiled usingPattern.compile(String), then thekeyis considered a Regular Expression and interest will be registered usingRegion.registerInterestRegex(String). -
containsNonAlphaNumericWhitespace
Determines whether the givenStringvalue contains at least 1 special character. -
isNotAlphaNumericWhitespace
protected boolean isNotAlphaNumericWhitespace(char character) Determines whether the givencharacteris a special character (non-alphanumeric, non-whitespace).- Parameters:
character-Characterto evaluate.- Returns:
- a boolean value indicating whether the given
characteris a special character. - See Also:
-
isAlphaNumericWhitespace
protected boolean isAlphaNumericWhitespace(char character) Determines whether the givencharacteris an alphanumeric or whitespace character.- Parameters:
character-Characterto evaluate.- Returns:
- a boolean value indicating whether the given
characteris an alphanumeric or whitespace character. - See Also:
-
isDurable
public boolean isDurable()Determines whether the interest registration is durable and persists between cache client sessions.- Returns:
- a boolean value indicating whether this interest registration is durable.
-
setDurable
public void setDurable(boolean durable) Sets whether interest registration is durable and persists between cache client sessions.- Parameters:
durable- boolean value to indicate whether this interest registration is durable.
-
getKey
Returns the key on which interest is registered.- Returns:
- the key of interest.
-
setKey
Sets the key on which interest is registered.- Parameters:
key- the key of interest.
-
getPolicy
public org.apache.geode.cache.InterestResultPolicy getPolicy()Returns theInterestResultPolicyused when interest is registered and determines whether KEYS, KEYS_VALUES or nothing (NONE) is initially fetched on initial registration.- Returns:
- the policy
-
setPolicy
Sets the initialInterestResultPolicyused when interest is first registered and determines whether KEYS, KEYS_VALUE or nothing (NONE) is initially fetched. The argument is set as anObjectto be able to accept bothInterestResultPolicyandStrings, used in XML configuration meta-data.- Parameters:
policy- initialInterestResultPolicyto set.- Throws:
IllegalArgumentException- if the givenpolicyis not a valid type.- See Also:
-
InterestResultPolicy
-
isReceiveValues
public boolean isReceiveValues()Returns the type of values received by the listener.- Returns:
- the receiveValues
-
setReceiveValues
public void setReceiveValues(boolean receiveValues) Switches between the different entities received by the listener.- Parameters:
receiveValues- the receiveValues to set
-
getType
Returns the type of interest registration (e.g. based on KEY or Regex).- Returns:
- a
Interest.Typedetermining the type of interest. - See Also:
-
setType
Set the type of interest registration (e.g. based on KEY or Regex).- Parameters:
type-Interest.Typequalifying the type of interest.- See Also:
-
isKeyType
public boolean isKeyType()Determines whether thisInterestis a KEY interest registration.- Returns:
- a boolean value indicating whether this is KEY interest.
- See Also:
-
isRegexType
public boolean isRegexType()Determines whether thisInterestis a REGEX interest registration.- Returns:
- a boolean value indicating whether this is REGEX interest.
- See Also:
-
toString
-
asType
Builder method to specify the type of interest registration.- Parameters:
type-Interest.Typeof interest registration.- Returns:
- this
Interest. - See Also:
-
makeDurable
Builder method to mark thisInterestas durable.- Returns:
- this
Interest. - See Also:
-
receivesValues
Builder method to set whether the interest event notifications will receive values along with keys.- Parameters:
receiveValues- boolean to indicate that value should be sent along with keys on interest event notifications.- Returns:
- this
Interest. - See Also:
-
usingPolicy
Builder method to set theInterestResultPolicyused to initialize the cache.- Parameters:
policy-InterestResultPolicy.- Returns:
- this
Interest. - See Also:
-
InterestResultPolicysetPolicy(Object)
-
withKey
Builder method to express the key of interest.- Parameters:
key- key of interests.- Returns:
- this
Interest. - See Also:
-