public class ResourceSqlQueryResolver extends AbstractCachingSqlQueryResolver implements org.springframework.core.Ordered
SqlQueryResolver
resolving sql queries using Spring's generic ResourceLoader
mechanism.AbstractCachingSqlQueryResolver.QueryHolder
Modifier and Type | Field and Description |
---|---|
static java.nio.charset.Charset |
DEFAULT_CHARSET
Default charset for retrieving sql query resources (
UTF_8 ). |
DEFAULT_CACHE_LIMIT
Constructor and Description |
---|
ResourceSqlQueryResolver() |
ResourceSqlQueryResolver(org.springframework.core.io.ResourceLoader resourceLoader) |
Modifier and Type | Method and Description |
---|---|
protected void |
doRefreshQueryHolder(java.lang.String sqlQueryName,
AbstractCachingSqlQueryResolver.QueryHolder queryHolder)
Subclasses may override this method to implement their own expiry mechanism.
|
java.nio.charset.Charset |
getCharset()
Return the
Charset for retrieving sql query resources. |
int |
getOrder()
Return the order in which this
SqlQueryResolver is evaluated. |
protected java.lang.String |
getPrefix()
Return the prefix that gets prepended to sql query names when building the resource location.
|
protected java.lang.String |
getSuffix()
Return the suffix that gets appended to sql query names when building the resource location.
|
protected java.lang.String |
loadSqlQuery(java.lang.String sqlQueryName,
AbstractCachingSqlQueryResolver.QueryHolder queryHolder)
Subclasses must implement this method to load the sql query.
|
void |
setCharset(java.nio.charset.Charset charset)
Set the
Charset for retrieving sql query resources. |
void |
setOrder(int order)
Set the order in which this
SqlQueryResolver is evaluated. |
void |
setPrefix(java.lang.String prefix)
Set the prefix that gets prepended to sql query names when building the resource location.
|
void |
setSuffix(java.lang.String suffix)
Set the suffix that gets appended to sql query names when building the resource location.
|
clearCache, getCacheKey, getCacheLimit, isCache, removeFromCache, resolveSqlQuery, setCache, setCacheLimit, setCacheSeconds, setCacheUnresolved
public static final java.nio.charset.Charset DEFAULT_CHARSET
UTF_8
).public ResourceSqlQueryResolver()
public ResourceSqlQueryResolver(org.springframework.core.io.ResourceLoader resourceLoader)
public java.nio.charset.Charset getCharset()
Charset
for retrieving sql query resources.public void setCharset(java.nio.charset.Charset charset)
Charset
for retrieving sql query resources.protected java.lang.String getPrefix()
public void setPrefix(java.lang.String prefix)
protected java.lang.String getSuffix()
public void setSuffix(java.lang.String suffix)
public int getOrder()
SqlQueryResolver
is evaluated.getOrder
in interface org.springframework.core.Ordered
public void setOrder(int order)
SqlQueryResolver
is evaluated.protected void doRefreshQueryHolder(java.lang.String sqlQueryName, AbstractCachingSqlQueryResolver.QueryHolder queryHolder)
AbstractCachingSqlQueryResolver
This method is only called when the current thread has a lock on the QueryHolder, so subclasses need not deal with thread-safety.
doRefreshQueryHolder
in class AbstractCachingSqlQueryResolver
sqlQueryName
- the name of the query to refreshqueryHolder
- the cached QueryHolder to checkprotected java.lang.String loadSqlQuery(java.lang.String sqlQueryName, AbstractCachingSqlQueryResolver.QueryHolder queryHolder) throws HawaiiException
AbstractCachingSqlQueryResolver
SqlQueryResolver
base class.loadSqlQuery
in class AbstractCachingSqlQueryResolver
sqlQueryName
- the name of the sql query to retrievequeryHolder
- the QueryHolder to enrichnull
if not found (optional, to allow for SqlQueryResolver
chaining)HawaiiException
- if the sql query could not be resolved (typically in case of problems resolving the sql query)AbstractCachingSqlQueryResolver.resolveSqlQuery(java.lang.String)