Interface ResourceResolver
- All Superinterfaces:
ResourceCacheResolvable
- All Known Implementing Classes:
AbstractResourceResolver
Resource
(s).-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes any resources used in thisResourceResolver
instance with the backend.findResources
(String baseAbsPath) findResources
(String baseAbsPath, Map<String, Object> pathVariables) findResources
(String baseAbsPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) findResources
(String baseAbsPath, ExchangeHint exchangeHint) Returns aResourceBeanMapper
.Returns a domain-specificResourceLinkResolver
for aResource
representation generated by thisResourceResolver
implementation.boolean
isLive()
Returns true if theResourceResolver
service for a backend is still alive.void
refresh()
Refreshes any local state changes, if any.Resolves singleResource
representation byabsPath
.Resolves singleResource
representation byabsPath
.Resolves singleResource
representation byabsPath
.resolve
(String absPath, ExchangeHint exchangeHint) resolveBinary
(String absPath) Resolves singleBinary
representation byabsPath
.resolveBinary
(String absPath, Map<String, Object> pathVariables) Resolves singleBinary
representation byabsPath
.resolveBinary
(String absPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) Resolves singleBinary
representation byabsPath
.resolveBinary
(String absPath, ExchangeHint exchangeHint) Resolves singleBinary
representation byabsPath
.resolveBinaryAsResource
(String absPath) resolveBinaryAsResource
(String absPath, Map<String, Object> pathVariables) resolveBinaryAsResource
(String absPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) resolveBinaryAsResource
(String absPath, ExchangeHint exchangeHint) resolveFullURI
(String absPath) Resolves a full URI determined and resolved for theabsPath
.resolveFullURI
(String absPath, Map<String, Object> pathVariables) Resolves a full URI determined and resolved for theabsPath
.Methods inherited from interface org.onehippo.cms7.crisp.api.resource.ResourceCacheResolvable
createCacheKey, fromCacheData, getResourceDataCache, isCacheable, isCacheEnabled, toCacheData
-
Method Details
-
resolve
Resolves singleResource
representation byabsPath
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.- Parameters:
absPath
- absolute path of aResource
- Returns:
- single
Resource
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolve
Resolves singleResource
representation byabsPath
with the optionalexchangeHint
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
absPath
- absolute path of aResource
exchangeHint
- a message exchange hint for the backend- Returns:
- single
Resource
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolve
Resolves singleResource
representation byabsPath
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
absPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andabsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.- Parameters:
absPath
- absolute path of aResource
pathVariables
- the variables to expand the template given byabsPath
- Returns:
- single
Resource
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolve
Resource resolve(String absPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) throws ResourceExceptionResolves singleResource
representation byabsPath
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
absPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andabsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
absPath
- absolute path of aResource
pathVariables
- the variables to expand the template given byabsPath
exchangeHint
- a message exchange hint for the backend- Returns:
- single
Resource
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinary
Resolves singleBinary
representation byabsPath
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.- Parameters:
absPath
- absolute path of aBinary
- Returns:
- single
Binary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinary
Resolves singleBinary
representation byabsPath
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
absPath
- absolute path of aBinary
exchangeHint
- a message exchange hint for the backend- Returns:
- single
Binary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinary
Resolves singleBinary
representation byabsPath
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
absPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andabsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.- Parameters:
absPath
- absolute path of aBinary
pathVariables
- the variables to expand the template given byabsPath
- Returns:
- single
Binary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinary
Binary resolveBinary(String absPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) throws ResourceExceptionResolves singleBinary
representation byabsPath
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
absPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andabsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
absPath
- absolute path of aBinary
pathVariables
- the variables to expand the template given byabsPath
exchangeHint
- a message exchange hint for the backend- Returns:
- single
Binary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinaryAsResource
Resolves singleBinary
representation byabsPath
, and convert it to aResource
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.- Parameters:
absPath
- absolute path of aBinary
- Returns:
- a
Resource
object converted from the singleBinary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinaryAsResource
Resource resolveBinaryAsResource(String absPath, ExchangeHint exchangeHint) throws ResourceException Resolves singleBinary
representation byabsPath
, and convert it to aResource
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
absPath
- absolute path of aBinary
exchangeHint
- a message exchange hint for the backend- Returns:
- a
Resource
object converted from the singleBinary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinaryAsResource
Resource resolveBinaryAsResource(String absPath, Map<String, Object> pathVariables) throws ResourceExceptionResolves singleBinary
representation byabsPath
, and convert it to aResource
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
absPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andabsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.- Parameters:
absPath
- absolute path of aBinary
pathVariables
- the variables to expand the template given byabsPath
- Returns:
- a
Resource
object converted from the singleBinary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinaryAsResource
Resource resolveBinaryAsResource(String absPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) throws ResourceExceptionResolves singleBinary
representation byabsPath
, and convert it to aResource
.absPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
absPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andabsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
absPath
- absolute path of aBinary
pathVariables
- the variables to expand the template given byabsPath
exchangeHint
- a message exchange hint for the backend- Returns:
- a
Resource
object converted from the singleBinary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
findResources
SearchResource
representations frombaseAbsPath
and returns a parentResource
representation which contains a collection of childResource
representations.baseAbsPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenbaseAbsPath
can be a URI path or part of URL. Or, as an example, thebaseAbsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.- Parameters:
baseAbsPath
- base absolute path of aResource
- Returns:
- a parent
Resource
representation which contains a collection of childResource
representations - Throws:
ResourceException
- if resource resolution operation fails
-
findResources
SearchResource
representations frombaseAbsPath
and returns a parentResource
representation which contains a collection of childResource
representations.baseAbsPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenbaseAbsPath
can be a URI path or part of URL. Or, as an example, thebaseAbsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
baseAbsPath
- base absolute path of aResource
exchangeHint
- a message exchange hint for the backend- Returns:
- a parent
Resource
representation which contains a collection of childResource
representations - Throws:
ResourceException
- if resource resolution operation fails
-
findResources
Resource findResources(String baseAbsPath, Map<String, Object> pathVariables) throws ResourceExceptionSearchResource
representations frombaseAbsPath
and returns a parentResource
representation which contains a collection of childResource
representations.baseAbsPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenbaseAbsPath
can be a URI path or part of URL. Or, as an example, thebaseAbsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
baseAbsPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andbaseAbsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.- Parameters:
baseAbsPath
- base absolute path of aResource
pathVariables
- the variables to expand the template given byabsPath
- Returns:
- a parent
Resource
representation which contains a collection of childResource
representations - Throws:
ResourceException
- if resource resolution operation fails
-
findResources
Resource findResources(String baseAbsPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) throws ResourceExceptionSearchResource
representations frombaseAbsPath
and returns a parentResource
representation which contains a collection of childResource
representations.baseAbsPath
is a domain-specific path template that should be meaningful to the backend. For example, if the backend is a REST API, thenbaseAbsPath
can be a URI path or part of URL. Or, as an example, thebaseAbsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
baseAbsPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andbaseAbsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
when making a real request to the backend.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Parameters:
baseAbsPath
- base absolute path of aResource
pathVariables
- the variables to expand the template given byabsPath
exchangeHint
- a message exchange hint for the backend- Returns:
- a parent
Resource
representation which contains a collection of childResource
representations - Throws:
ResourceException
- if resource resolution operation fails
-
isLive
Returns true if theResourceResolver
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.- Returns:
- true if the
ResourceResolver
service for a backend is still alive. true by default - Throws:
ResourceException
- if resource resolution operation fails
-
refresh
Refreshes any local state changes, if any.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.- Throws:
ResourceException
- if resource resolution operation fails
-
close
Closes any resources used in thisResourceResolver
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.
- Throws:
ResourceException
- if resource resolution operation fails
-
getResourceLinkResolver
ResourceLinkResolver getResourceLinkResolver()Returns a domain-specificResourceLinkResolver
for aResource
representation generated by thisResourceResolver
implementation.- Returns:
- a domain-specific
ResourceLinkResolver
for aResource
representation generated by thisResourceResolver
implementation
-
getResourceBeanMapper
Returns aResourceBeanMapper
.- Returns:
- a
ResourceBeanMapper
- Throws:
UnsupportedOperationException
- if aResourceBeanMapper
is not supportedResourceException
-
resolveFullURI
Resolves a full URI determined and resolved for theabsPath
. 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, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.- Parameters:
absPath
- absolute path of aResource
- Returns:
- URI representation by
absPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveFullURI
Resolves a full URI determined and resolved for theabsPath
. 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, thenabsPath
can be a URI path or part of URL. Or, as an example, theabsPath
can be an index name of a search index, table name of databases or node path in JCR, totally depending onResourceResolver
implementations.The
absPath
template is expanded using the given path variables (pathVariables
), if any. For example, ifpathVariables
looks like{"var1":"hello","var2":"world"}
andabsPath
is".../some/path/{var1}/{var2}/overview"
, then it is expanded to".../some/path/hello/world/overview"
by thepathVariables
.- Parameters:
absPath
- absolute path of aResource
pathVariables
- the variables to expand the template given byabsPath
- Returns:
- URI representation by
absPath
- Throws:
ResourceException
- if resource resolution operation fails
-