Class GeoPackageCoreCache<T extends GeoPackageCore>

  • Type Parameters:
    T - templated GeoPackage object

    public abstract class GeoPackageCoreCache<T extends GeoPackageCore>
    extends Object
    Abstract GeoPackage Core Cache for maintaining and reusing open GeoPackage connections
    Author:
    osbornb
    • Constructor Detail

      • GeoPackageCoreCache

        public GeoPackageCoreCache()
        Constructor
    • Method Detail

      • isCloseQuietly

        public boolean isCloseQuietly()
        Is close quietly mode enabled
        Returns:
        true if close quiet mode
        Since:
        3.1.0
      • setCloseQuietly

        public void setCloseQuietly​(boolean closeQuietly)
        Set the close quietly mode
        Parameters:
        closeQuietly - true to close quietly
        Since:
        3.1.0
      • getNames

        public Set<String> getNames()
        Get the names of the cached GeoPackages
        Returns:
        set of cached GeoPackage names
        Since:
        1.0.1
      • getGeoPackages

        public Collection<T> getGeoPackages()
        Get the cached GeoPackages
        Returns:
        collection of cached GeoPackages
        Since:
        1.0.1
      • has

        public boolean has​(String name)
        Determine if the cache has the GeoPackage name
        Parameters:
        name - GeoPackage name
        Returns:
        true if has cached GeoPackage
        Since:
        3.1.0
      • get

        public T get​(String name)
        Get the GeoPackage with name
        Parameters:
        name - GeoPackage name
        Returns:
        cached GeoPackage
      • exists

        public boolean exists​(String name)
        Checks if the GeoPackage name exists in the cache
        Parameters:
        name - GeoPackage name
        Returns:
        true if exists
      • closeAll

        public void closeAll()
        Close all GeoPackages in the cache
      • add

        public void add​(T geoPackage)
        Add a GeoPackage to the cache
        Parameters:
        geoPackage - GeoPackage
      • addAll

        public void addAll​(Collection<T> geoPackages)
        Add the collection of GeoPackages
        Parameters:
        geoPackages - GeoPackages
        Since:
        3.0.2
      • remove

        public T remove​(String name)
        Remove the GeoPackage with the name but does not close it, call close(String) to close and remove
        Parameters:
        name - GeoPackage name
        Returns:
        removed GeoPackage
      • clear

        public void clear()
        Clears all cached GeoPackages but does not close them, call closeAll() to close and clear all GeoPackages
        Since:
        1.0.1
      • removeAndClose

        public boolean removeAndClose​(String name)
        Remove and close the GeoPackage with name, same as close(String)
        Parameters:
        name - GeoPackage name
        Returns:
        true if found, removed, and closed
      • close

        public boolean close​(String name)
        Close the GeoPackage with name
        Parameters:
        name - GeoPackage name
        Returns:
        true if found and closed
        Since:
        1.0.1
      • closeRetain

        public void closeRetain​(Collection<String> retain)
        Close GeoPackages not specified in the retain GeoPackage names
        Parameters:
        retain - GeoPackages to retain
        Since:
        1.0.1
      • close

        public void close​(Collection<String> names)
        Close GeoPackages with names
        Parameters:
        names - GeoPackage names
        Since:
        1.0.1
      • close

        public void close​(T geoPackage)
        Close the GeoPackage
        Parameters:
        geoPackage - GeoPackage
        Since:
        3.1.0
      • closeIfCached

        public boolean closeIfCached​(T geoPackage)
        Close the GeoPackage if it is cached (same GeoPackage instance)
        Parameters:
        geoPackage - GeoPackage
        Returns:
        true if closed
        Since:
        3.1.0
      • closeIfNotCached

        public boolean closeIfNotCached​(T geoPackage)
        Close the GeoPackage if it is not cached (GeoPackage not cached or different instance)
        Parameters:
        geoPackage - GeoPackage
        Returns:
        true if closed
        Since:
        3.1.0