Package mil.nga.geopackage
Class GeoPackageCoreCache<T extends GeoPackageCore>
- java.lang.Object
-
- mil.nga.geopackage.GeoPackageCoreCache<T>
-
- 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 Summary
Constructors Constructor Description GeoPackageCoreCache()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T geoPackage)
Add a GeoPackage to the cachevoid
addAll(Collection<T> geoPackages)
Add the collection of GeoPackagesvoid
clear()
Clears all cached GeoPackages but does not close them, callcloseAll()
to close and clear all GeoPackagesboolean
close(String name)
Close the GeoPackage with namevoid
close(Collection<String> names)
Close GeoPackages with namesvoid
close(T geoPackage)
Close the GeoPackagevoid
closeAll()
Close all GeoPackages in the cacheboolean
closeIfCached(T geoPackage)
Close the GeoPackage if it is cached (same GeoPackage instance)boolean
closeIfNotCached(T geoPackage)
Close the GeoPackage if it is not cached (GeoPackage not cached or different instance)void
closeRetain(Collection<String> retain)
Close GeoPackages not specified in the retain GeoPackage namesboolean
exists(String name)
Checks if the GeoPackage name exists in the cacheT
get(String name)
Get the GeoPackage with nameCollection<T>
getGeoPackages()
Get the cached GeoPackagesSet<String>
getNames()
Get the names of the cached GeoPackagesboolean
has(String name)
Determine if the cache has the GeoPackage nameboolean
isCloseQuietly()
Is close quietly mode enabledT
remove(String name)
Remove the GeoPackage with the name but does not close it, callclose(String)
to close and removeboolean
removeAndClose(String name)
Remove and close the GeoPackage with name, same asclose(String)
void
setCloseQuietly(boolean closeQuietly)
Set the close quietly mode
-
-
-
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, callclose(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, callcloseAll()
to close and clear all GeoPackages- Since:
- 1.0.1
-
removeAndClose
public boolean removeAndClose(String name)
Remove and close the GeoPackage with name, same asclose(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
-
-