Class AbstractResourceServiceBroker
- All Implemented Interfaces:
ResourceServiceBroker
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key name for the exchange hint, which can be used in cache key generation as an attribute name.static final String
Key name for an invoked operation name, which can be used in cache key generation as an attribute name.static final String
Key name ofOPERATION_KEY
infindResources(String, String, Map)
operation invocation, which can be used in cache key generation as an attribute name.static final String
Key name ofOPERATION_KEY
inresolve(String, String, Map)
operation invocation, which can be used in cache key generation as an attribute name.static final String
Key name for the path variables to be used in the physical invocation path (or URI) expansion, which can be used in cache key generation as an attribute name.static final String
Key name for the relative resource path in an invocation, which can be used in cache key generation as an attribute name.static final String
Key name for the resource space name in an invocation, which can be used in cache key generation as an attribute name. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindResources
(String resourceSpace, String baseAbsPath) Resolves a properResourceResolver
by the specifiedresourceSpace
and searchResource
representations frombaseAbsPath
and returns a parentResource
representation which contains a collection of childResource
representations.Resolves a properResourceResolver
by the specifiedresourceSpace
and searchResource
representations frombaseAbsPath
and returns a parentResource
representation which contains a collection of childResource
representations.findResources
(String resourceSpace, String baseAbsPath, ExchangeHint exchangeHint) Resolves a properResourceResolver
by the specifiedresourceSpace
and searchResource
representations frombaseAbsPath
and returns a parentResource
representation which contains a collection of childResource
representations.getResourceBeanMapper
(String resourceSpace) Returns a properResourceBeanMapper
for the givenresourceSpace
.getResourceDataCache
(String resourceSpace) Returns a proper resource cache store representation (ResourceDataCache
) for the specifiedresourceSpace
, or null if caching is disabled.protected ResourceResolver
getResourceResolver
(String resourceSpace) Finds and returns aResourceResolver
by the specifiedresourceSpace
.ReturnsResourceResolverProvider
that finds and returns a properResourceResolver
.Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves singleResource
representation byabsPath
.Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves singleResource
representation byabsPath
.resolve
(String resourceSpace, String absResourcePath, ExchangeHint exchangeHint) Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves singleResource
representation byabsPath
.resolveBinary
(String resourceSpace, String absResourcePath) Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves singleBinary
representation byabsPath
.Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves singleBinary
representation byabsPath
.resolveBinary
(String resourceSpace, String absResourcePath, ExchangeHint exchangeHint) Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves singleBinary
representation byabsPath
.resolveBinaryAsResource
(String resourceSpace, String absResourcePath) Resolves a properResourceResolver
by the specifiedresourceSpace
, resolves singleBinary
representation byabsPath
, and converts theBinary
representation into aResource
.resolveBinaryAsResource
(String resourceSpace, String absResourcePath, Map<String, Object> pathVariables) Resolves a properResourceResolver
by the specifiedresourceSpace
, resolves singleBinary
representation byabsPath
, and converts theBinary
representation into aResource
.resolveBinaryAsResource
(String resourceSpace, String absResourcePath, ExchangeHint exchangeHint) Resolves a properResourceResolver
by the specifiedresourceSpace
, resolves singleBinary
representation byabsPath
, and converts theBinary
representation into aResource
.resolveFullURI
(String resourceSpace, String absPath) Resolves a full URI determined and resolved for the specificresourceSpace
and theabsPath
.Resolves a full URI determined and resolved for the specificresourceSpace
and theabsPath
.resolveLink
(String resourceSpace, Resource resource) Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves aResourceLink
for the givenresource
.Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves aResourceLink
for the givenresource
with passinglinkVariables
that can be used by implementation to expand its internal link generation template.void
setResourceResolverProvider
(ResourceResolverProvider resourceResolverProvider) SetsResourceResolverProvider
that finds and returns a properResourceResolver
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.onehippo.cms7.crisp.api.broker.ResourceServiceBroker
findResources, resolve, resolveBinary, resolveBinaryAsResource
-
Field Details
-
OPERATION_KEY
Key name for an invoked operation name, which can be used in cache key generation as an attribute name.- See Also:
-
RESOURCE_SPACE
Key name for the resource space name in an invocation, which can be used in cache key generation as an attribute name.- See Also:
-
RESOURCE_PATH
Key name for the relative resource path in an invocation, which can be used in cache key generation as an attribute name.- See Also:
-
PATH_VARIABLES
Key name for the path variables to be used in the physical invocation path (or URI) expansion, which can be used in cache key generation as an attribute name.- See Also:
-
EXCHANGE_HINT
Key name for the exchange hint, which can be used in cache key generation as an attribute name.- See Also:
-
OPERATION_KEY_RESOLVE
Key name ofOPERATION_KEY
inresolve(String, String, Map)
operation invocation, which can be used in cache key generation as an attribute name. -
OPERATION_KEY_FIND_RESOURCES
Key name ofOPERATION_KEY
infindResources(String, String, Map)
operation invocation, which can be used in cache key generation as an attribute name.
-
-
Constructor Details
-
AbstractResourceServiceBroker
public AbstractResourceServiceBroker()Default constructor.
-
-
Method Details
-
getResourceResolverProvider
ReturnsResourceResolverProvider
that finds and returns a properResourceResolver
.- Returns:
ResourceResolverProvider
that finds and returns a properResourceResolver
-
setResourceResolverProvider
SetsResourceResolverProvider
that finds and returns a properResourceResolver
.- Parameters:
resourceResolverProvider
-ResourceResolverProvider
that finds and returns a properResourceResolver
-
resolve
Resolves a properResourceResolver
by the specifiedresourceSpace
and 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.- Specified by:
resolve
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- absolute path of aResource
- Returns:
- single
Resource
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolve
public Resource resolve(String resourceSpace, String absResourcePath, ExchangeHint exchangeHint) throws ResourceException Resolves a properResourceResolver
by the specifiedresourceSpace
and 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.If a non-null
exchangeHint
is given, then it can be understood by the specificResourceResolver
implementation for its specific backend.- Specified by:
resolve
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- 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
public Resource resolve(String resourceSpace, String absResourcePath, Map<String, Object> pathVariables) throws ResourceExceptionResolves a properResourceResolver
by the specifiedresourceSpace
and 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.- Specified by:
resolve
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- 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
-
resolveBinary
Resolves a properResourceResolver
by the specifiedresourceSpace
and 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.- Specified by:
resolveBinary
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- absolute path of aBinary
- Returns:
- single
Binary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinary
public Binary resolveBinary(String resourceSpace, String absResourcePath, ExchangeHint exchangeHint) throws ResourceException Resolves a properResourceResolver
by the specifiedresourceSpace
and 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.- Specified by:
resolveBinary
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- 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
public Binary resolveBinary(String resourceSpace, String absResourcePath, Map<String, Object> pathVariables) throws ResourceExceptionResolves a properResourceResolver
by the specifiedresourceSpace
and 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.- Specified by:
resolveBinary
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- 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
-
resolveBinaryAsResource
public Resource resolveBinaryAsResource(String resourceSpace, String absResourcePath) throws ResourceException Description copied from interface:ResourceServiceBroker
Resolves a properResourceResolver
by the specifiedresourceSpace
, resolves singleBinary
representation byabsPath
, and converts theBinary
representation into 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.- Specified by:
resolveBinaryAsResource
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- absolute path of aBinary
- Returns:
- a
Resource
object converted from the singleBinary
representation byabsPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveBinaryAsResource
public Resource resolveBinaryAsResource(String resourceSpace, String absResourcePath, ExchangeHint exchangeHint) throws ResourceException Description copied from interface:ResourceServiceBroker
Resolves a properResourceResolver
by the specifiedresourceSpace
, resolves singleBinary
representation byabsPath
, and converts theBinary
representation into 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.- Specified by:
resolveBinaryAsResource
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- 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
public Resource resolveBinaryAsResource(String resourceSpace, String absResourcePath, Map<String, Object> pathVariables) throws ResourceExceptionDescription copied from interface:ResourceServiceBroker
Resolves a properResourceResolver
by the specifiedresourceSpace
, resolves singleBinary
representation byabsPath
, and converts theBinary
representation into 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.- Specified by:
resolveBinaryAsResource
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absResourcePath
- 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
-
findResources
Resolves a properResourceResolver
by the specifiedresourceSpace
and 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.- Specified by:
findResources
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
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
public Resource findResources(String resourceSpace, String baseAbsPath, ExchangeHint exchangeHint) throws ResourceException Resolves a properResourceResolver
by the specifiedresourceSpace
and 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.- Specified by:
findResources
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
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
public Resource findResources(String resourceSpace, String baseAbsPath, Map<String, Object> pathVariables) throws ResourceExceptionResolves a properResourceResolver
by the specifiedresourceSpace
and 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.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.- Specified by:
findResources
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
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
-
resolveLink
Resolves a properResourceResolver
by the specifiedresourceSpace
and resolves aResourceLink
for the givenresource
.- Specified by:
resolveLink
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
resource
- resource representation- Returns:
- a
ResourceLink
for the givenresource
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveLink
public ResourceLink resolveLink(String resourceSpace, Resource resource, Map<String, Object> linkVariables) throws ResourceExceptionResolves a properResourceResolver
by the specifiedresourceSpace
and resolves aResourceLink
for the givenresource
with passinglinkVariables
that can be used by implementation to expand its internal link generation template.How the
linkVariables
is used in link generation template expansion is totally up to an implementation.- Specified by:
resolveLink
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
resource
- resource representationlinkVariables
- the variables to expand the internal link generation template- Returns:
- a
ResourceLink
for the givenresource
- Throws:
ResourceException
- if resource resolution operation fails
-
getResourceDataCache
Returns a proper resource cache store representation (ResourceDataCache
) for the specifiedresourceSpace
, or null if caching is disabled.An implementation may return a default resource cache store representation (
ResourceDataCache
) as a fallback if the resolvedResourceResolver
doesn't have its ownResourceDataCache
instance (in other words, if the resolvedResourceCacheResolvable.getResourceDataCache()
return null).If an underlying resource resolver is explicitly disabled on caching (in other words, if the resolved
ResourceCacheResolvable.isCacheEnabled()
returns false), it should return null.- Specified by:
getResourceDataCache
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
- Returns:
- a proper resource cache store representation (
ResourceDataCache
) for the specifiedresourceSpace
, or a fallbackResourceDataCache
if the resolvedResourceResolver
doesn't have its ownResourceDataCache
instance - Throws:
ResourceException
- if resource space is not found
-
getResourceBeanMapper
Returns a properResourceBeanMapper
for the givenresourceSpace
.- Specified by:
getResourceBeanMapper
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
- Returns:
- a proper
ResourceBeanMapper
for the givenresourceSpace
- Throws:
ResourceException
- if resource space is not found
-
resolveFullURI
Description copied from interface:ResourceServiceBroker
Resolves a full URI determined and resolved for the specificresourceSpace
and 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.- Specified by:
resolveFullURI
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
absPath
- absolute path of aResource
- Returns:
- URI representation by
absPath
- Throws:
ResourceException
- if resource resolution operation fails
-
resolveFullURI
public URI resolveFullURI(String resourceSpace, String absPath, Map<String, Object> pathVariables) throws ResourceExceptionDescription copied from interface:ResourceServiceBroker
Resolves a full URI determined and resolved for the specificresourceSpace
and 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
.- Specified by:
resolveFullURI
in interfaceResourceServiceBroker
- Parameters:
resourceSpace
- Resource space name to resolve a properResourceResolver
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
-
getResourceResolver
Finds and returns aResourceResolver
by the specifiedresourceSpace
.- Parameters:
resourceSpace
- resource space name- Returns:
- a
ResourceResolver
by the specifiedresourceSpace
- Throws:
ResourceException
- if resource resolve is not found
-