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 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(String sqlQueryName,
AbstractCachingSqlQueryResolver.QueryHolder queryHolder)
Subclasses may override this method to implement their own expiry mechanism.
|
Charset |
getCharset()
Return the
Charset for retrieving sql query resources. |
int |
getOrder()
Return the order in which this
SqlQueryResolver is evaluated. |
protected String |
getPrefix()
Return the prefix that gets prepended to sql query names when building the resource location.
|
protected String |
getSuffix()
Return the suffix that gets appended to sql query names when building the resource location.
|
protected String |
loadSqlQuery(String sqlQueryName,
AbstractCachingSqlQueryResolver.QueryHolder queryHolder)
Subclasses must implement this method to load the sql query.
|
void |
setCharset(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(String prefix)
Set the prefix that gets prepended to sql query names when building the resource location.
|
void |
setSuffix(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 Charset DEFAULT_CHARSET
UTF_8
).public ResourceSqlQueryResolver()
public ResourceSqlQueryResolver(org.springframework.core.io.ResourceLoader resourceLoader)
public Charset getCharset()
Charset
for retrieving sql query resources.public void setCharset(Charset charset)
Charset
for retrieving sql query resources.protected String getPrefix()
public void setPrefix(String prefix)
protected String getSuffix()
public void setSuffix(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(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 String loadSqlQuery(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)