protected abstract static class ResourceCapableCacheDataImporterExporter.AbstractCacheResourceResolver extends ResourceLoaderResourceResolver implements org.springframework.context.ApplicationContextAware, ResourceCapableCacheDataImporterExporter.CacheResourceResolver, org.springframework.context.EnvironmentAware
cache based
ResourceResolvers, whether for import or export.ResourceLoaderResourceResolver,
ApplicationContextAware,
EnvironmentAware,
ResourceCapableCacheDataImporterExporter.CacheResourceResolver| Constructor and Description |
|---|
AbstractCacheResourceResolver()
Constructs a new instance of
ResourceCapableCacheDataImporterExporter.AbstractCacheResourceResolver. |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
evaluate(java.lang.String expressionString,
org.apache.geode.cache.Region<?,?> region)
Evaluates the given SpEL
expression. |
protected java.util.Optional<org.springframework.context.ApplicationContext> |
getApplicationContext()
Returns an
Optional reference to a Spring ApplicationContext. |
protected java.util.Optional<org.springframework.core.env.Environment> |
getEnvironment()
Returns an
Optional reference to the Spring Environment. |
protected org.springframework.expression.ExpressionParser |
getExpressionParser()
Gets the configured
ExpressionParser used to parse SpEL expressions. |
protected java.lang.String |
getFullyQualifiedResourceLocation(org.apache.geode.cache.Region<?,?> region)
Determines a fully-qualified
resource location for the given Region. |
protected org.slf4j.Logger |
getLogger()
Return the configured
Logger to log messages. |
protected org.springframework.expression.ParserContext |
getParserContext()
Gets the configured
ParserContext used by the ExpressionParser to identify SpEL expressions. |
protected java.lang.String |
getResourceLocation(org.apache.geode.cache.Region<?,?> region,
java.lang.String propertyName)
Determines the
location of a Resource for the given Region. |
protected java.lang.String |
getResourceName(org.apache.geode.cache.Region<?,?> region)
Determines a
resource name for the given Region. |
protected java.lang.String |
getResourceName(java.lang.String name)
Determines a
resource name for the given name. |
protected abstract java.lang.String |
getResourcePath()
Get the
base path for the targeted Resource. |
protected boolean |
isQualified(org.springframework.core.io.Resource resource)
Determines whether the
Resource is a qualified Resource. |
protected org.springframework.expression.EvaluationContext |
newEvaluationContext()
Constructs a new
EvaluationContext used during the evaluation of SpEL expressions. |
protected org.springframework.expression.Expression |
parse(java.lang.String expressionString)
Parses the given
expressionString. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Configures a reference to the Spring
ApplicationContext. |
void |
setEnvironment(org.springframework.core.env.Environment environment)
Configures a reference to the Spring
Environment. |
getClassLoader, getResourceLoader, newResource, newResourceLoader, onMissingResource, postProcess, resolve, setResourceLoaderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitresolve, resolvegetClassLoader, requirepublic AbstractCacheResourceResolver()
ResourceCapableCacheDataImporterExporter.AbstractCacheResourceResolver.
This constructor initializes the SpEL objects used to parse and evaluate SpEL expressions in order to
fully qualify and resolve Resource locations defined as properties
in Spring Boot application.properties for Import & Export Resources.@NonNull protected org.springframework.expression.EvaluationContext newEvaluationContext()
EvaluationContext used during the evaluation of SpEL expressions.EvaluationContext; never null.EvaluationContextpublic void setApplicationContext(@Nullable
org.springframework.context.ApplicationContext applicationContext)
ApplicationContext.setApplicationContext in interface org.springframework.context.ApplicationContextAwareapplicationContext - reference to the ApplicationContext.ApplicationContextprotected java.util.Optional<org.springframework.context.ApplicationContext> getApplicationContext()
Optional reference to a Spring ApplicationContext.Optional reference to a Spring ApplicationContext.ApplicationContext,
Optionalpublic void setEnvironment(org.springframework.core.env.Environment environment)
Environment.setEnvironment in interface org.springframework.context.EnvironmentAwareenvironment - reference to the Environment.Environmentprotected java.util.Optional<org.springframework.core.env.Environment> getEnvironment()
Optional reference to the Spring Environment.Optional reference to the Spring Environment.Environment,
Optional@NonNull protected org.springframework.expression.ExpressionParser getExpressionParser()
ExpressionParser used to parse SpEL expressions.ExpressionParser; never null.ExpressionParserprotected org.slf4j.Logger getLogger()
Logger to log messages.Logger.Logger@NonNull protected org.springframework.expression.ParserContext getParserContext()
ParserContext used by the ExpressionParser to identify SpEL expressions.ParserContext.ParserContextprotected boolean isQualified(@Nullable
org.springframework.core.io.Resource resource)
ResourceLoaderResourceResolverResource is a qualified Resource.
Qualifications are determined by the application Requirements and Use Case (UC) at time of resolution.
For example, it maybe that the Resource must exist to qualify, or that
the Resource must have a valid protocol, path and name.
This default implementation requires the target Resource to not be null.isQualified in class ResourceLoaderResourceResolverresource - Resource to qualify.Resource is qualified.Resource@NonNull
protected java.lang.String getFullyQualifiedResourceLocation(@NonNull
org.apache.geode.cache.Region<?,?> region)
resource location for the given Region.region - Region to evaluate; must not be null.resource location for the given Region.Region,
getResourceName(Region),
getResourcePath()@NonNull
protected java.lang.String getResourceLocation(@NonNull
org.apache.geode.cache.Region<?,?> region,
@NonNull
java.lang.String propertyName)
location of a Resource for the given Region.region - Region used to locate the desired Resource; must not be null.Resource location for the given Region.java.lang.IllegalArgumentException - if Region is null.Region@Nullable
protected java.lang.String evaluate(@NonNull
java.lang.String expressionString,
@NonNull
org.apache.geode.cache.Region<?,?> region)
expression.expressionString - String containing the SpEL expression to evaluate; must not be null.region - Region used to resolve regionName variable references
in the expression; must not be null.expression.Expression.getValue(EvaluationContext, Object),
Region,
parse(String)protected org.springframework.expression.Expression parse(java.lang.String expressionString)
expressionString.
This method will cache parsed Expressions to speed up the evaluation process.expressionString - String containing the SpEL expression to parse.Expression object parsed from the given expression.ExpressionParser.parseExpression(String, ParserContext),
Expression,
getExpressionParser(),
getParserContext()@NonNull
protected java.lang.String getResourceName(@NonNull
org.apache.geode.cache.Region<?,?> region)
resource name for the given Region.
The default implementation bases the resource name on
the Region's lowercase name.region - Region to evaluate; must not be null.resource name for the given Region.Region,
getResourceName(String)@NonNull
protected java.lang.String getResourceName(@NonNull
java.lang.String name)
resource name for the given name.name - String containing the name to evaluate; must not be null.resource name from the given name.@NonNull protected abstract java.lang.String getResourcePath()
base path for the targeted Resource.base path for the targeted Resource.