Class MountInfo

  • All Implemented Interfaces:
    Mount

    public final class MountInfo
    extends Object
    implements Mount
    Default Mount implementation for non-default mounts.
    • Constructor Detail

      • MountInfo

        public MountInfo​(String name,
                         boolean readOnly,
                         List<String> pathsSupportingFragments,
                         List<String> includedPaths)
    • Method Detail

      • isUnder

        public boolean isUnder​(String path)
        Description copied from interface: Mount
        Checks if this mount falls under given path.

        For e.g. if a mount consist of '/etc/config'. Then if path is

        • /etc - Then it returns true
        • /etc/config - Then it returns false
        • /lib - Then it returns false
        Specified by:
        isUnder in interface Mount
        Parameters:
        path - path to check
        Returns:
        true if this Mount is rooted under given path
      • isDirectlyUnder

        public boolean isDirectlyUnder​(String path)
        Description copied from interface: Mount
        Checks if this mount directly falls under given path.

        For e.g. if a mount consist of '/etc/my/config'. Then if path is

        • /etc - Then it returns false
        • /etc/my - Then it returns true
        • /etc/my/config- Then it returns false
        • /lib - Then it returns false
        Specified by:
        isDirectlyUnder in interface Mount
        Parameters:
        path - path to check
        Returns:
        true if this Mount is rooted directly under given path
      • isMounted

        public boolean isMounted​(String path)
        Description copied from interface: Mount
        Checks if given path belongs to this Mount

        A path belongs to a Mount in two scenarios:

        1. The path is below a fragment-supported path and the path contains a fragment name.
        2. The path of this mount is the most specific ancestor for the specified path.

        The fragment check has a higher priority, and the presence of a fragment name in the path always decides the mount this path belongs to.

        Specified by:
        isMounted in interface Mount
        Parameters:
        path - path to check
        Returns:
        true if path belong to this mount
        See Also:
        Mount.getPathFragmentName()
      • getName

        public String getName()
        Description copied from interface: Mount
        Name of the mount. If this @Mount is the default mount, an empty string is returned
        Specified by:
        getName in interface Mount
      • isReadOnly

        public boolean isReadOnly()
        Description copied from interface: Mount
        Checks whether the mount is marked as read only.
        Specified by:
        isReadOnly in interface Mount
        Returns:
        true if the mount is read only.
      • isDefault

        public boolean isDefault()
        Description copied from interface: Mount
        Checks whether current mount is the default mount.

        The Default mount includes the root path and all other paths which are not part of any other mount.

        Specified by:
        isDefault in interface Mount
        Returns:
        true if this mount represents the default mount
      • isSupportFragment

        public boolean isSupportFragment​(String path)
        Description copied from interface: Mount
        Checks if this mount supports mounting nodes containing the fragment (see Mount.getPathFragmentName()) under the given path.
        Specified by:
        isSupportFragment in interface Mount
        Parameters:
        path - ancestor path
        Returns:
        true if the path fragment mounts are supported in the given subtree
      • isSupportFragmentUnder

        public boolean isSupportFragmentUnder​(String path)
        Description copied from interface: Mount
        Checks if any path supporting the fragments falls under the specified path.
        Specified by:
        isSupportFragmentUnder in interface Mount
        Parameters:
        path - ancestor path
        Returns:
        true if the path fragment mounts are supported under some descendants of the specified path
      • getPathFragmentName

        public String getPathFragmentName()
        Description copied from interface: Mount
        Returns fragment name which can be used to construct node name used for storing meta content belonging to path under this Mount. Such a node name would be used by NodeStore to determine the storage for nodes under those paths.

        Fragment name is formatted as 'oak:mount-<mount name>'

        For e.g. for mount name 'private' the fragment name would be oak:mount-private. This can be then used to construct node name like oak:mount-private-index and then any derived content for path under this mount would be stored as child node under oak:mount-private-index like /fooIndex/oak:mount-private-index/foo. Such paths would then be stored in a separate store which would only be storing paths belonging to that mount

        If this Mount is the default mount, an empty string is returned

        Specified by:
        getPathFragmentName in interface Mount
        Returns:
        node name prefix which can be used
      • getPathsSupportingFragments

        public Set<String> getPathsSupportingFragments()
      • getIncludedPaths

        public Set<String> getIncludedPaths()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object