public abstract class AbstractResourceResolver extends AbstractResourceCacheResolvable implements ResourceResolver
ResourceResolver
base class.Constructor and Description |
---|
AbstractResourceResolver() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes any resources used in this
ResourceResolver instance with the backend. |
Resource |
findResources(String baseAbsPath)
|
Resource |
findResources(String baseAbsPath,
ExchangeHint exchangeHint)
|
Resource |
findResources(String baseAbsPath,
Map<String,Object> pathVariables)
|
ResourceBeanMapper |
getResourceBeanMapper()
Returns a
ResourceBeanMapper . |
ResourceLinkResolver |
getResourceLinkResolver()
Returns a domain-specific
ResourceLinkResolver for a Resource representation generated by
this ResourceResolver implementation. |
boolean |
isLive()
Returns true if the
ResourceResolver service for a backend is still alive. |
void |
refresh()
Refreshes any local state changes, if any.
|
Resource |
resolve(String absPath)
Resolves single
Resource representation by absPath . |
Resource |
resolve(String absPath,
ExchangeHint exchangeHint)
|
Resource |
resolve(String absPath,
Map<String,Object> pathVariables)
Resolves single
Resource representation by absPath . |
Binary |
resolveBinary(String absPath)
Resolves single
Binary representation by absPath . |
Binary |
resolveBinary(String absPath,
ExchangeHint exchangeHint)
Resolves single
Binary representation by absPath . |
Binary |
resolveBinary(String absPath,
Map<String,Object> pathVariables)
Resolves single
Binary representation by absPath . |
Resource |
resolveBinaryAsResource(String absPath)
|
Resource |
resolveBinaryAsResource(String absPath,
ExchangeHint exchangeHint)
|
Resource |
resolveBinaryAsResource(String absPath,
Map<String,Object> pathVariables)
|
URI |
resolveFullURI(String absPath)
Resolves a full URI determined and resolved for the
absPath . |
URI |
resolveFullURI(String absPath,
Map<String,Object> pathVariables)
Resolves a full URI determined and resolved for the
absPath . |
void |
setResourceLinkResolver(ResourceLinkResolver resourceLinkResolver)
Sets
ResourceLinkResolver . |
createCacheKey, fromCacheData, getResourceDataCache, isCacheable, isCacheEnabled, setCacheEnabled, setResourceDataCache, toCacheData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findResources, resolve, resolveBinary, resolveBinaryAsResource
createCacheKey, fromCacheData, getResourceDataCache, isCacheable, isCacheEnabled, toCacheData
public Resource resolve(String absPath) throws ResourceException
Resource
representation by absPath
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
resolve
in interface ResourceResolver
absPath
- absolute path of a Resource
Resource
representation by absPath
ResourceException
- if resource resolution operation failspublic Resource resolve(String absPath, ExchangeHint exchangeHint) throws ResourceException
Resource
representation by absPath
with the optional exchangeHint
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
If a non-null exchangeHint
is given, then it can be understood by the specific ResourceResolver
implementation for its specific backend.
resolve
in interface ResourceResolver
absPath
- absolute path of a Resource
exchangeHint
- a message exchange hint for the backendResource
representation by absPath
ResourceException
- if resource resolution operation failspublic Resource resolve(String absPath, Map<String,Object> pathVariables) throws ResourceException
Resource
representation by absPath
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
The absPath
template is expanded using the given path variables (pathVariables
), if any.
For example, if pathVariables
looks like {"var1":"hello","var2":"world"}
and absPath
is ".../some/path/{var1}/{var2}/overview"
, then it is expanded to
".../some/path/hello/world/overview"
by the pathVariables
when making a real request
to the backend.
resolve
in interface ResourceResolver
absPath
- absolute path of a Resource
pathVariables
- the variables to expand the template given by absPath
Resource
representation by absPath
ResourceException
- if resource resolution operation failspublic Binary resolveBinary(String absPath) throws ResourceException
Binary
representation by absPath
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
resolveBinary
in interface ResourceResolver
absPath
- absolute path of a Binary
Binary
representation by absPath
ResourceException
- if resource resolution operation failspublic Binary resolveBinary(String absPath, ExchangeHint exchangeHint) throws ResourceException
Binary
representation by absPath
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
If a non-null exchangeHint
is given, then it can be understood by the specific ResourceResolver
implementation for its specific backend.
resolveBinary
in interface ResourceResolver
absPath
- absolute path of a Binary
exchangeHint
- a message exchange hint for the backendBinary
representation by absPath
ResourceException
- if resource resolution operation failspublic Binary resolveBinary(String absPath, Map<String,Object> pathVariables) throws ResourceException
Binary
representation by absPath
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
The absPath
template is expanded using the given path variables (pathVariables
), if any.
For example, if pathVariables
looks like {"var1":"hello","var2":"world"}
and absPath
is ".../some/path/{var1}/{var2}/overview"
, then it is expanded to
".../some/path/hello/world/overview"
by the pathVariables
when making a real request
to the backend.
resolveBinary
in interface ResourceResolver
absPath
- absolute path of a Binary
pathVariables
- the variables to expand the template given by absPath
Binary
representation by absPath
ResourceException
- if resource resolution operation failspublic Resource resolveBinaryAsResource(String absPath) throws ResourceException
ResourceResolver
Binary
representation by absPath
, and convert it to a Resource
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
resolveBinaryAsResource
in interface ResourceResolver
absPath
- absolute path of a Binary
Resource
object converted from the single Binary
representation by absPath
ResourceException
- if resource resolution operation failspublic Resource resolveBinaryAsResource(String absPath, ExchangeHint exchangeHint) throws ResourceException
ResourceResolver
Binary
representation by absPath
, and convert it to a Resource
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
If a non-null exchangeHint
is given, then it can be understood by the specific ResourceResolver
implementation for its specific backend.
resolveBinaryAsResource
in interface ResourceResolver
absPath
- absolute path of a Binary
exchangeHint
- a message exchange hint for the backendResource
object converted from the single Binary
representation by absPath
ResourceException
- if resource resolution operation failspublic Resource resolveBinaryAsResource(String absPath, Map<String,Object> pathVariables) throws ResourceException
ResourceResolver
Binary
representation by absPath
, and convert it to a Resource
.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
The absPath
template is expanded using the given path variables (pathVariables
), if any.
For example, if pathVariables
looks like {"var1":"hello","var2":"world"}
and absPath
is ".../some/path/{var1}/{var2}/overview"
, then it is expanded to
".../some/path/hello/world/overview"
by the pathVariables
when making a real request
to the backend.
resolveBinaryAsResource
in interface ResourceResolver
absPath
- absolute path of a Binary
pathVariables
- the variables to expand the template given by absPath
Resource
object converted from the single Binary
representation by absPath
ResourceException
- if resource resolution operation failspublic Resource findResources(String baseAbsPath) throws ResourceException
Resource
representations from baseAbsPath
and returns a parent Resource
representation
which contains a collection of child Resource
representations.
baseAbsPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then baseAbsPath
can be a URI path or part of URL. Or, as
an example, the baseAbsPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
findResources
in interface ResourceResolver
baseAbsPath
- base absolute path of a Resource
Resource
representation which contains a collection of child Resource
representationsResourceException
- if resource resolution operation failspublic Resource findResources(String baseAbsPath, ExchangeHint exchangeHint) throws ResourceException
Resource
representations from baseAbsPath
and returns a parent Resource
representation
which contains a collection of child Resource
representations.
baseAbsPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then baseAbsPath
can be a URI path or part of URL. Or, as
an example, the baseAbsPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
If a non-null exchangeHint
is given, then it can be understood by the specific ResourceResolver
implementation for its specific backend.
findResources
in interface ResourceResolver
baseAbsPath
- base absolute path of a Resource
exchangeHint
- a message exchange hint for the backendResource
representation which contains a collection of child Resource
representationsResourceException
- if resource resolution operation failspublic Resource findResources(String baseAbsPath, Map<String,Object> pathVariables) throws ResourceException
Resource
representations from baseAbsPath
and returns a parent Resource
representation
which contains a collection of child Resource
representations.
baseAbsPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then baseAbsPath
can be a URI path or part of URL. Or, as
an example, the baseAbsPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
The baseAbsPath
template is expanded using the given path variables (pathVariables
), if any.
For example, if pathVariables
looks like {"var1":"hello","var2":"world"}
and baseAbsPath
is ".../some/path/{var1}/{var2}/overview"
, then it is expanded to
".../some/path/hello/world/overview"
by the pathVariables
when making a real request
to the backend.
findResources
in interface ResourceResolver
baseAbsPath
- base absolute path of a Resource
pathVariables
- the variables to expand the template given by absPath
Resource
representation which contains a collection of child Resource
representationsResourceException
- if resource resolution operation failspublic boolean isLive() throws ResourceException
ResourceResolver
service for a backend is still alive. Returns true by default.
An implementation may choose to implement this method to check if the underlying connection with the
backend is still alive in this method. In REST API based implementation, it is likely to simply return true
in this method. However, for example, an implementation with JCR backend may use javax.jcr.Session#isLive()
method in its implementation.
isLive
in interface ResourceResolver
ResourceResolver
service for a backend is still alive. true by defaultResourceException
- if resource resolution operation failspublic void refresh() throws ResourceException
An implementation may choose to implement this method to give a chance to refresh local states. In REST
API based implementation, it is likely to simply do nothing in this method. However, for example, an implementation
with JCR backend may use javax.jcr.Session#refresh(boolean)
method in its implementation.
refresh
in interface ResourceResolver
ResourceException
- if resource resolution operation failspublic void close() throws ResourceException
ResourceResolver
instance with the backend.
An implementation may choose to implement this method to give a chance to close any resources used in this implementation. In REST API based implementation, it is likely to simply do nothing in this method if the REST API is stateless. However, for example, an implementation with a stateful connection may close its connection to the backend in this method.
close
in interface ResourceResolver
ResourceException
- if resource resolution operation failspublic ResourceLinkResolver getResourceLinkResolver()
ResourceLinkResolver
for a Resource
representation generated by
this ResourceResolver
implementation.getResourceLinkResolver
in interface ResourceResolver
ResourceLinkResolver
for a Resource
representation generated by
this ResourceResolver
implementationpublic void setResourceLinkResolver(ResourceLinkResolver resourceLinkResolver)
ResourceLinkResolver
.resourceLinkResolver
- ResourceLinkResolver
that resolves a link for a Resource
representationpublic ResourceBeanMapper getResourceBeanMapper() throws ResourceException
ResourceBeanMapper
.getResourceBeanMapper
in interface ResourceResolver
ResourceBeanMapper
ResourceException
public URI resolveFullURI(String absPath) throws ResourceException
ResourceResolver
absPath
.
Or returns null if the backend cannot support a full URI access.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
resolveFullURI
in interface ResourceResolver
absPath
- absolute path of a Resource
absPath
ResourceException
- if resource resolution operation failspublic URI resolveFullURI(String absPath, Map<String,Object> pathVariables) throws ResourceException
ResourceResolver
absPath
.
Or returns null if the backend cannot support a full URI access.
absPath
is a domain-specific path template that should be meaningful to the backend.
For example, if the backend is a REST API, then absPath
can be a URI path or part of URL. Or, as
an example, the absPath
can be an index name of a search index, table name of databases or node
path in JCR, totally depending on ResourceResolver
implementations.
The absPath
template is expanded using the given path variables (pathVariables
), if any.
For example, if pathVariables
looks like {"var1":"hello","var2":"world"}
and absPath
is ".../some/path/{var1}/{var2}/overview"
, then it is expanded to
".../some/path/hello/world/overview"
by the pathVariables
.
resolveFullURI
in interface ResourceResolver
absPath
- absolute path of a Resource
pathVariables
- the variables to expand the template given by absPath
absPath
ResourceException
- if resource resolution operation failsCopyright © 2017–2020 Hippo B.V. (http://www.onehippo.com). All rights reserved.