Interface ResourceResolver

All Superinterfaces:
ResourceCacheResolvable
All Known Implementing Classes:
AbstractResourceResolver

public interface ResourceResolver extends ResourceCacheResolvable
Responsible for resolving Resource(s).
  • Method Details

    • resolve

      Resource resolve(String absPath) throws ResourceException
      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:
      absPath - absolute path of a Resource
      Returns:
      single Resource representation by absPath
      Throws:
      ResourceException - if resource resolution operation fails
    • resolve

      Resource resolve(String absPath, ExchangeHint exchangeHint) throws ResourceException
      Resolves single 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.

      Parameters:
      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 absPath, Map<String,Object> pathVariables) throws ResourceException
      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:
      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 absPath, Map<String,Object> pathVariables, ExchangeHint exchangeHint) throws ResourceException
      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:
      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 absPath) throws ResourceException
      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:
      absPath - absolute path of a Binary
      Returns:
      single Binary representation by absPath
      Throws:
      ResourceException - if resource resolution operation fails
    • resolveBinary

      Binary resolveBinary(String absPath, ExchangeHint exchangeHint) throws ResourceException
      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:
      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 absPath, Map<String,Object> pathVariables) throws ResourceException
      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:
      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 absPath, Map<String,Object> pathVariables, ExchangeHint exchangeHint) throws ResourceException
      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:
      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 absPath) throws ResourceException
      Resolves single 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.

      Parameters:
      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 absPath, ExchangeHint exchangeHint) throws ResourceException
      Resolves single 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.

      Parameters:
      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 absPath, Map<String,Object> pathVariables) throws ResourceException
      Resolves single 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.

      Parameters:
      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 absPath, Map<String,Object> pathVariables, ExchangeHint exchangeHint) throws ResourceException
      Resolves single 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.

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

      Parameters:
      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 baseAbsPath) throws ResourceException
      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:
      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 baseAbsPath, ExchangeHint exchangeHint) throws ResourceException
      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:
      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 baseAbsPath, Map<String,Object> pathVariables) throws ResourceException
      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:
      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 baseAbsPath, Map<String,Object> pathVariables, ExchangeHint exchangeHint) throws ResourceException
      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:
      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
    • isLive

      boolean isLive() throws ResourceException
      Returns true if the 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.

      Returns:
      true if the ResourceResolver service for a backend is still alive. true by default
      Throws:
      ResourceException - if resource resolution operation fails
    • refresh

      void refresh() throws ResourceException
      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

      void close() throws ResourceException
      Closes any resources used in this 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.

      Throws:
      ResourceException - if resource resolution operation fails
    • getResourceLinkResolver

      ResourceLinkResolver getResourceLinkResolver()
      Returns a domain-specific ResourceLinkResolver for a Resource representation generated by this ResourceResolver implementation.
      Returns:
      a domain-specific ResourceLinkResolver for a Resource representation generated by this ResourceResolver implementation
    • getResourceBeanMapper

      ResourceBeanMapper getResourceBeanMapper() throws ResourceException
      Returns:
      a ResourceBeanMapper
      Throws:
      UnsupportedOperationException - if a ResourceBeanMapper is not supported
      ResourceException
    • resolveFullURI

      URI resolveFullURI(String absPath) throws ResourceException
      Resolves a full URI determined and resolved for 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:
      absPath - absolute path of a Resource
      Returns:
      URI representation by absPath
      Throws:
      ResourceException - if resource resolution operation fails
    • resolveFullURI

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