Class ExpirationConfiguration.ExpirationPolicyMetaData
java.lang.Object
org.springframework.data.gemfire.config.annotation.ExpirationConfiguration.ExpirationPolicyMetaData
- All Implemented Interfaces:
ExpirationConfiguration.ExpirationPolicyConfigurer
- Enclosing class:
- ExpirationConfiguration
protected static class ExpirationConfiguration.ExpirationPolicyMetaData
extends Object
implements ExpirationConfiguration.ExpirationPolicyConfigurer
ExpirationConfiguration.ExpirationPolicyMetaData
is a ExpirationConfiguration.ExpirationPolicyConfigurer
implementation that encapsulates
the expiration configuration meta-data (e.g. expiration timeout and action) necessary to configure
a Regions's
expiration policy and behavior.
This class is meant to capture the expiration configuration meta-data specified in the EnableExpiration.ExpirationPolicy
nested annotation in the application-level EnableExpiration
annotation.-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
ExpirationPolicyMetaData
(int timeout, ExpirationActionType action, Set<String> regionNames, Set<EnableExpiration.ExpirationType> types) Constructs an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given expiration policy configuraiton meta-data andRegion
expiration settings.protected
ExpirationPolicyMetaData
(org.apache.geode.cache.ExpirationAttributes expirationAttributes, Set<String> regionNames, Set<EnableExpiration.ExpirationType> types) Constructs an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given expiration policy configuraiton meta-data andRegion
expiration settings. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Determines whether the givenObject
(e.g.protected boolean
Determines whether to apply this expiration policy to the givenRegion
identified by name.protected boolean
accepts
(org.apache.geode.cache.Region<?, ?> region) Determines whether the givenRegion
is accepted for Eviction policy configuration.Configures the expiration policy for the givenRegion
.org.apache.geode.cache.Region<?,
?> configure
(org.apache.geode.cache.Region<?, ?> region) Configures the expiration policy for the givenRegion
.protected org.apache.geode.cache.ExpirationAttributes
Returns the defaultExpirationAttributes
.protected static ExpirationConfiguration.ExpirationPolicyMetaData
from
(org.springframework.core.annotation.AnnotationAttributes expirationPolicyAttributes) Factory method to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the givenAnnotationAttributes
from the nestedEnableExpiration.ExpirationPolicy
annotation specified in an application-levelEnableExpiration
annotation.protected static ExpirationConfiguration.ExpirationPolicyMetaData
from
(EnableExpiration.ExpirationPolicy expirationPolicy) Factory method to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given attribute values from the nestedEnableExpiration.ExpirationPolicy
annotation specified in an application-levelEnableExpiration
annotation.protected static ExpirationConfiguration.ExpirationPolicyMetaData
Factory method to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
using default expiration policy settings.protected boolean
Determines whether Idle Timeout Expiration (TTI) was configured for this expiration policy.protected boolean
Determines whether Time-To-Live Expiration (TTL) was configured for this expiration policy.protected static org.apache.geode.cache.ExpirationAttributes
newExpirationAttributes
(int timeout, org.apache.geode.cache.ExpirationAction action) Factory method used to construct a new instance of theExpirationAttributes
initialized with the given expiration timeout and action that is taken when anRegion
entry times out.protected static org.apache.geode.cache.ExpirationAttributes
newExpirationAttributes
(int timeout, ExpirationActionType action) Factory method used to construct a new instance of theExpirationAttributes
initialized with the given expiration timeout and action that is taken when anRegion
entry times out.protected static ExpirationConfiguration.ExpirationPolicyMetaData
newExpirationPolicyMetaData
(int timeout, ExpirationActionType action, String[] regionNames, EnableExpiration.ExpirationType[] types) Factory method used to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given expiration policy meta-data.protected static ExpirationActionType
resolveAction
(ExpirationActionType action) Resolves theExpirationAction
used in the expiration policy.protected String
resolveRegionName
(Object regionFactoryBean) Resolves the name of a givenRegion
from the correspondingResolvableRegionFactoryBean
object.protected static int
resolveTimeout
(int timeout) Resolves the expiration timeout used in the expiration policy.protected ExpiringRegionFactoryBean<?,
?> setExpirationAttributes
(ExpiringRegionFactoryBean<?, ?> regionFactoryBean) Configures the Expiration policies on the targetedExpiringRegionFactoryBean
, which may be either aPeerRegionFactoryBean
orClientRegionFactoryBean
.
-
Field Details
-
ALL_REGIONS
-
-
Constructor Details
-
ExpirationPolicyMetaData
protected ExpirationPolicyMetaData(int timeout, ExpirationActionType action, Set<String> regionNames, Set<EnableExpiration.ExpirationType> types) Constructs an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given expiration policy configuraiton meta-data andRegion
expiration settings.- Parameters:
timeout
- int value indicating the expiration timeout in seconds.action
- expiration action taken when theRegion
entry expires.regionNames
- names ofRegions
configured with the expiration policy meta-data.types
- type of expiration algorithm/behavior (TTI/TTL) configured for theRegion
.- Throws:
IllegalArgumentException
- if theEnableExpiration.ExpirationType
Set
is empty.- See Also:
-
ExpirationPolicyMetaData
protected ExpirationPolicyMetaData(org.apache.geode.cache.ExpirationAttributes expirationAttributes, Set<String> regionNames, Set<EnableExpiration.ExpirationType> types) Constructs an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given expiration policy configuraiton meta-data andRegion
expiration settings.- Parameters:
expirationAttributes
-ExpirationAttributes
specifying the expiration timeout in seconds and expiration action taken when theRegion
entry expires.regionNames
- names ofRegions
configured with the expiration policy meta-data.types
- type of expiration algorithm/behaviors (TTI/TTL) configured for theRegion
.- Throws:
IllegalArgumentException
- if theEnableExpiration.ExpirationType
Set
is empty.- See Also:
-
EnableExpiration.ExpirationType
ExpirationAttributes
-
-
Method Details
-
from
protected static ExpirationConfiguration.ExpirationPolicyMetaData from(org.springframework.core.annotation.AnnotationAttributes expirationPolicyAttributes) Factory method to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the givenAnnotationAttributes
from the nestedEnableExpiration.ExpirationPolicy
annotation specified in an application-levelEnableExpiration
annotation.- Parameters:
expirationPolicyAttributes
-AnnotationAttributes
from aEnableExpiration.ExpirationPolicy
annotation.- Returns:
- an instance of the
ExpirationConfiguration.ExpirationPolicyMetaData
initialized fromEnableExpiration.ExpirationPolicy
AnnotationAttributes
. - Throws:
IllegalArgumentException
- ifAnnotationAttributes.annotationType()
is not assignable toEnableExpiration.ExpirationPolicy
.- See Also:
-
newExpirationPolicyMetaData(int, ExpirationActionType, String[], ExpirationType[])
AnnotationAttributes
-
from
protected static ExpirationConfiguration.ExpirationPolicyMetaData from(EnableExpiration.ExpirationPolicy expirationPolicy) Factory method to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given attribute values from the nestedEnableExpiration.ExpirationPolicy
annotation specified in an application-levelEnableExpiration
annotation.- Parameters:
expirationPolicy
-EnableExpiration.ExpirationPolicy
annotation containing the attribute values used to initialize theExpirationConfiguration.ExpirationPolicyMetaData
instance.- Returns:
- an instance of the
ExpirationConfiguration.ExpirationPolicyMetaData
initialized fromEnableExpiration.ExpirationPolicy
attributes values. - See Also:
-
fromDefaults
Factory method to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
using default expiration policy settings. -
newExpirationAttributes
protected static org.apache.geode.cache.ExpirationAttributes newExpirationAttributes(int timeout, ExpirationActionType action) Factory method used to construct a new instance of theExpirationAttributes
initialized with the given expiration timeout and action that is taken when anRegion
entry times out.- Parameters:
timeout
- int value indicating the expiration timeout in seconds.action
- expiration action to take when theRegion
entry times out.- Returns:
- a new instance of
ExpirationAttributes
initialized with the given expiration timeout and action. - See Also:
-
ExpirationAttributes
newExpirationAttributes(int, ExpirationAction)
-
newExpirationAttributes
protected static org.apache.geode.cache.ExpirationAttributes newExpirationAttributes(int timeout, org.apache.geode.cache.ExpirationAction action) Factory method used to construct a new instance of theExpirationAttributes
initialized with the given expiration timeout and action that is taken when anRegion
entry times out.- Parameters:
timeout
- int value indicating the expiration timeout in seconds.action
- expiration action to take when theRegion
entry times out.- Returns:
- a new instance of
ExpirationAttributes
initialized with the given expiration timeout and action. - See Also:
-
ExpirationAttributes
-
newExpirationPolicyMetaData
protected static ExpirationConfiguration.ExpirationPolicyMetaData newExpirationPolicyMetaData(int timeout, ExpirationActionType action, String[] regionNames, EnableExpiration.ExpirationType[] types) Factory method used to construct an instance ofExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given expiration policy meta-data.- Parameters:
timeout
- int value indicating the expiration timeout in seconds.action
- expiration action taken when theRegion
entry expires.regionNames
- names ofRegions
configured with the expiration policy meta-data.types
- type of expiration algorithm/behavior (TTI/TTL) configured for theRegion
.- Returns:
- an instance of
ExpirationConfiguration.ExpirationPolicyMetaData
initialized with the given expiration policy meta-data. - Throws:
IllegalArgumentException
- if theEnableExpiration.ExpirationType
array is empty.- See Also:
-
resolveAction
Resolves theExpirationAction
used in the expiration policy. Defaults toExpirationActionType.INVALIDATE
ifaction
is null.- Parameters:
action
- givenExpirationActionType
to evaluate.- Returns:
- the resolved
ExpirationActionType
or the default ifaction
is null. - See Also:
-
resolveTimeout
protected static int resolveTimeout(int timeout) Resolves the expiration timeout used in the expiration policy. Defaults to 0 iftimeout
is less than 0.- Parameters:
timeout
- int value expressing the expiration timeout in seconds.- Returns:
- the resolved expiration policy timeout.
-
accepts
Determines whether the givenObject
(e.g. Spring bean) is accepted for Eviction policy configuration. -
accepts
protected boolean accepts(org.apache.geode.cache.Region<?, ?> region) Determines whether the givenRegion
is accepted for Eviction policy configuration.- Parameters:
region
-Region
being evaluated as a Eviction policy configuration candidate.- Returns:
- a boolean value indicated whether the given
Region
is accepted as an Expiration policy configuration candidate. - See Also:
-
Region
accepts(Supplier)
-
accepts
Determines whether to apply this expiration policy to the givenRegion
identified by name.- Parameters:
regionName
- name of theRegion
to evaluate.- Returns:
- a boolean value indicating whether the expiration policy applies to the given
Region
identified by name.
-
isIdleTimeout
protected boolean isIdleTimeout()Determines whether Idle Timeout Expiration (TTI) was configured for this expiration policy.- Returns:
- a boolean value indicating whether Idle Timeout Expiration (TTI) was configuration for this expiration policy.
-
isTimeToLive
protected boolean isTimeToLive()Determines whether Time-To-Live Expiration (TTL) was configured for this expiration policy.- Returns:
- a boolean value indicating whether Time-To-Live Expiration (TTL) was configuration for this expiration policy.
-
resolveRegionName
Resolves the name of a givenRegion
from the correspondingResolvableRegionFactoryBean
object.- Parameters:
regionFactoryBean
-ResolvableRegionFactoryBean
from which to resolve theRegion
name.- Returns:
- the resolved name of the
Region
created from the givenResolvableRegionFactoryBean
. - See Also:
-
setExpirationAttributes
protected ExpiringRegionFactoryBean<?,?> setExpirationAttributes(ExpiringRegionFactoryBean<?, ?> regionFactoryBean) Configures the Expiration policies on the targetedExpiringRegionFactoryBean
, which may be either aPeerRegionFactoryBean
orClientRegionFactoryBean
.- Parameters:
regionFactoryBean
-ExpiringRegionFactoryBean
to configure.- Returns:
- the given
ExpiringRegionFactoryBean
. - See Also:
-
configure
Description copied from interface:ExpirationConfiguration.ExpirationPolicyConfigurer
Configures the expiration policy for the givenRegion
.- Specified by:
configure
in interfaceExpirationConfiguration.ExpirationPolicyConfigurer
- Parameters:
regionBean
-Region
object who's expiration policy will be configured.- Returns:
- the given
Region
object. - See Also:
-
Region
-
configure
public org.apache.geode.cache.Region<?,?> configure(org.apache.geode.cache.Region<?, ?> region) Description copied from interface:ExpirationConfiguration.ExpirationPolicyConfigurer
Configures the expiration policy for the givenRegion
.- Specified by:
configure
in interfaceExpirationConfiguration.ExpirationPolicyConfigurer
- Parameters:
region
-Region
who's expiration policy will be configured.- Returns:
- the given
Region
. - See Also:
-
Region
-
defaultExpirationAttributes
protected org.apache.geode.cache.ExpirationAttributes defaultExpirationAttributes()Returns the defaultExpirationAttributes
.- Returns:
- an
ExpirationAttributes
containing the defaults. - See Also:
-
ExpirationAttributes
-