Interface ResourceServiceBroker

  • All Known Implementing Classes:
    AbstractDelegatingResourceServiceBroker, AbstractResourceServiceBroker

    public interface ResourceServiceBroker
    CRISP Resource Service Broker abstraction.

    This interface abstracts a "Broker" pattern for various Resources from different backends. So, application codes can simply invoke operations of this "Broker" interface to retrieve or manipulate any Resources from different backends without having to worry about the details about the underlying backends.

    Another important aspect is that this "Broker" interface takes care of caching of Resource representations and cache invalidations. So, application codes do not have to worry about caching and cache invalidations in application layer any more, but they can transparently invoke the operations of this interface. Then this "Broker" implementation should take care of all the details including caching, cache invalidations, etc.

    Also, this "Broker" service is normally registered through HippoServiceRegistry. So, applications can access this singleton "Broker" service like the following example:

     ResourceServiceBroker broker = HippoServiceRegistry.getService(ResourceServiceBroker.class);
     
    • Method Detail

      • resolve

        Resource resolve​(String resourceSpace,
                         String absPath)
                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Resource
        Returns:
        single Resource representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolve

        Resource resolve​(String resourceSpace,
                         String absPath,
                         ExchangeHint exchangeHint)
                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        If a non-null exchangeHint is given, then it can be understood by the specific ResourceResolver implementation for its specific backend.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Resource
        exchangeHint - a message exchange hint for the backend
        Returns:
        single Resource representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolve

        Resource resolve​(String resourceSpace,
                         String absPath,
                         Map<String,​Object> pathVariables)
                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Resource
        pathVariables - the variables to expand the template given by absPath
        Returns:
        single Resource representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolve

        Resource resolve​(String resourceSpace,
                         String absPath,
                         Map<String,​Object> pathVariables,
                         ExchangeHint exchangeHint)
                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        If a non-null exchangeHint is given, then it can be understood by the specific ResourceResolver implementation for its specific backend.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Resource
        pathVariables - the variables to expand the template given by absPath
        exchangeHint - a message exchange hint for the backend
        Returns:
        single Resource representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinary

        Binary resolveBinary​(String resourceSpace,
                             String absPath)
                      throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        Returns:
        single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinary

        Binary resolveBinary​(String resourceSpace,
                             String absPath,
                             ExchangeHint exchangeHint)
                      throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        exchangeHint - a message exchange hint for the backend
        Returns:
        single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinary

        Binary resolveBinary​(String resourceSpace,
                             String absPath,
                             Map<String,​Object> pathVariables)
                      throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        pathVariables - the variables to expand the template given by absPath
        Returns:
        single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinary

        Binary resolveBinary​(String resourceSpace,
                             String absPath,
                             Map<String,​Object> pathVariables,
                             ExchangeHint exchangeHint)
                      throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves single 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.

        If a non-null exchangeHint is given, then it can be understood by the specific ResourceResolver implementation for its specific backend.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        pathVariables - the variables to expand the template given by absPath
        exchangeHint - a message exchange hint for the backend
        Returns:
        single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinaryAsResource

        Resource resolveBinaryAsResource​(String resourceSpace,
                                         String absPath)
                                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace, resolves single Binary representation by absPath, and converts the Binary representation into 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        Returns:
        a Resource object converted from the single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinaryAsResource

        Resource resolveBinaryAsResource​(String resourceSpace,
                                         String absPath,
                                         ExchangeHint exchangeHint)
                                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace, resolves single Binary representation by absPath, and converts the Binary representation into 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        exchangeHint - a message exchange hint for the backend
        Returns:
        a Resource object converted from the single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinaryAsResource

        Resource resolveBinaryAsResource​(String resourceSpace,
                                         String absPath,
                                         Map<String,​Object> pathVariables)
                                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace, resolves single Binary representation by absPath, and converts the Binary representation into 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        pathVariables - the variables to expand the template given by absPath
        Returns:
        a Resource object converted from the single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveBinaryAsResource

        Resource resolveBinaryAsResource​(String resourceSpace,
                                         String absPath,
                                         Map<String,​Object> pathVariables,
                                         ExchangeHint exchangeHint)
                                  throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace, resolves single Binary representation by absPath, and converts the Binary representation into 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.

        If a non-null exchangeHint is given, then it can be understood by the specific ResourceResolver implementation for its specific backend.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Binary
        pathVariables - the variables to expand the template given by absPath
        exchangeHint - a message exchange hint for the backend
        Returns:
        a Resource object converted from the single Binary representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • findResources

        Resource findResources​(String resourceSpace,
                               String baseAbsPath)
                        throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and search 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        baseAbsPath - base absolute path of a Resource
        Returns:
        a parent Resource representation which contains a collection of child Resource representations
        Throws:
        ResourceException - if resource resolution operation fails
      • findResources

        Resource findResources​(String resourceSpace,
                               String baseAbsPath,
                               ExchangeHint exchangeHint)
                        throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and search 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        baseAbsPath - base absolute path of a Resource
        exchangeHint - a message exchange hint for the backend
        Returns:
        a parent Resource representation which contains a collection of child Resource representations
        Throws:
        ResourceException - if resource resolution operation fails
      • findResources

        Resource findResources​(String resourceSpace,
                               String baseAbsPath,
                               Map<String,​Object> pathVariables)
                        throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and search 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        baseAbsPath - base absolute path of a Resource
        pathVariables - the variables to expand the template given by absPath
        Returns:
        a parent Resource representation which contains a collection of child Resource representations
        Throws:
        ResourceException - if resource resolution operation fails
      • findResources

        Resource findResources​(String resourceSpace,
                               String baseAbsPath,
                               Map<String,​Object> pathVariables,
                               ExchangeHint exchangeHint)
                        throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and search 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.

        If a non-null exchangeHint is given, then it can be understood by the specific ResourceResolver implementation for its specific backend.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        baseAbsPath - base absolute path of a Resource
        pathVariables - the variables to expand the template given by absPath
        exchangeHint - a message exchange hint for the backend
        Returns:
        a parent Resource representation which contains a collection of child Resource representations
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveLink

        ResourceLink resolveLink​(String resourceSpace,
                                 Resource resource,
                                 Map<String,​Object> linkVariables)
                          throws ResourceException
        Resolves a proper ResourceResolver by the specified resourceSpace and resolves a ResourceLink for the given resource with passing linkVariables 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        resource - resource representation
        linkVariables - the variables to expand the internal link generation template
        Returns:
        a ResourceLink for the given resource
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveFullURI

        URI resolveFullURI​(String resourceSpace,
                           String absPath)
                    throws ResourceException
        Resolves a full URI determined and resolved for the specific resourceSpace and the 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Resource
        Returns:
        URI representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails
      • resolveFullURI

        URI resolveFullURI​(String resourceSpace,
                           String absPath,
                           Map<String,​Object> pathVariables)
                    throws ResourceException
        Resolves a full URI determined and resolved for the specific resourceSpace and the 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.

        Parameters:
        resourceSpace - Resource space name to resolve a proper ResourceResolver
        absPath - absolute path of a Resource
        pathVariables - the variables to expand the template given by absPath
        Returns:
        URI representation by absPath
        Throws:
        ResourceException - if resource resolution operation fails