Class CachingNameResolver

  • All Implemented Interfaces:
    NameResolver

    public class CachingNameResolver
    extends java.lang.Object
    implements NameResolver
    Name resolver decorator that uses a generational cache to speed up parsing and formatting of JCR names. Uncached names are resolved using the underlying decorated name resolver.
    • Constructor Summary

      Constructors 
      Constructor Description
      CachingNameResolver​(NameResolver resolver)
      Creates a caching decorator for the given name resolver.
      CachingNameResolver​(NameResolver resolver, org.apache.jackrabbit.spi.commons.conversion.GenerationalCache cache)
      Creates a caching decorator for the given name resolver.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getJCRName​(Name name)
      Returns the prefixed JCR name for the given Name.
      Name getQName​(java.lang.String jcrName)
      Returns a Name for the given prefixed JCR name.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachingNameResolver

        public CachingNameResolver​(NameResolver resolver,
                                   org.apache.jackrabbit.spi.commons.conversion.GenerationalCache cache)
        Creates a caching decorator for the given name resolver. The given generational cache is used for caching.
        Parameters:
        resolver - decorated name resolver
        cache - generational cache
      • CachingNameResolver

        public CachingNameResolver​(NameResolver resolver)
        Creates a caching decorator for the given name resolver.
        Parameters:
        resolver - name resolver
    • Method Detail

      • getQName

        public Name getQName​(java.lang.String jcrName)
                      throws IllegalNameException,
                             NamespaceException
        Returns a Name for the given prefixed JCR name. The name is first looked up form the generational cache and the call gets delegated to the decorated name resolver only if the cache misses.
        Specified by:
        getQName in interface NameResolver
        Parameters:
        jcrName - A JCR name String.
        Returns:
        A Name object.
        Throws:
        IllegalNameException - if the JCR name format is invalid
        NamespaceException - if the namespace prefix can not be resolved
      • getJCRName

        public java.lang.String getJCRName​(Name name)
                                    throws NamespaceException
        Returns the prefixed JCR name for the given Name. The name is first looked up form the generational cache and the call gets delegated to the decorated name resolver only if the cache misses.
        Specified by:
        getJCRName in interface NameResolver
        Parameters:
        name - The name object.
        Returns:
        qualified JCR name in the form prefix:localName.
        Throws:
        NamespaceException - if the namespace URI can not be resolved