Package org.geotools.imageio.netcdf
Class AncillaryFileManager
- Object
-
- AncillaryFileManager
-
- All Implemented Interfaces:
FileSetManager
public class AncillaryFileManager extends Object implements FileSetManager
A class used to store any auxiliary indexing information such as the low level indexer definition as well as the datastore properties configuration specifying where to build that index.Since 14.x is it also possible to store the catalog into a PostGis based DB
- Author:
- Daniele Romagnoli, GeoSolutions SAS
-
-
Field Summary
Fields Modifier and Type Field Description protected static Map<String,DataStoreConfiguration>DATASTORE_CONFIG_CACHEprotected static Map<String,Indexer>INDEXER_CACHE
-
Constructor Summary
Constructors Constructor Description AncillaryFileManager(File netcdfFile, String indexFilePath)AncillaryFileManager(File netcdfFile, String indexFilePath, String datastoreFilePath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsVariable(String varName)Indexer.Coverages.CoverageaddCoverage(String varName)voidaddFile(String filePath)Add a file to the file set managervoidaddSlice(Slice2DIndex variableIndex)static voidclearCache()Clear the parsed configs (datastore and indexer) cachestatic StringconvertToHex(byte[] data)voiddispose()Dispose the ManagerNamegetCoverageName(String varName)Return aNamerepresentation of the coverage nameList<Name>getCoveragesNames()Get the list of Names for the underlying coverage listDataStoreConfigurationgetDatastoreConfiguration()Create theDataStoreConfigurationusing the external datastoreIndexFile if provided, or the H2 based default.FilegetDatastoreIndexFile()FilegetDestinationDir()FilegetIndexerFile()StringgetParameter(String parameterKey)booleangetParameterAsBoolean(String parameterKey)Slice2DIndexgetSlice2DIndex(int imageIndex)Return aSlice2DIndexrelated to the provided imageIndexFilegetSlicesIndexFile()StringgetTypeName(String coverageName)Returns the schema definition name for a given coverage (the schema definition name is not normally used in the database, which uses the coverage name instead)protected voidinitIndexer()Retrieve basic indexer properties by scanning the indexer XML instance.voidinitSliceManager()booleanisImposedSchema()List<String>list()Return the list of all the files currently added to the managervoidpurge()Remove all the files from the manager (An implementation may also physically remove all the files)voidremoveFile(String filePath)Remove a file from the manager (An implementation may also physically remove the file)voidresetSliceManager()StringsetSchema(Indexer.Coverages.Coverage coverage, String schemaName, String schemaDef)Add the default schema to this coveragevoidwriteToDisk()Write indexer to disk
-
-
-
Constructor Detail
-
AncillaryFileManager
public AncillaryFileManager(File netcdfFile, String indexFilePath) throws IOException, JAXBException, NoSuchAlgorithmException
- Throws:
IOExceptionJAXBExceptionNoSuchAlgorithmException
-
AncillaryFileManager
public AncillaryFileManager(File netcdfFile, String indexFilePath, String datastoreFilePath) throws IOException, JAXBException, NoSuchAlgorithmException
- Throws:
IOExceptionJAXBExceptionNoSuchAlgorithmException
-
-
Method Detail
-
writeToDisk
public void writeToDisk() throws IOException, JAXBExceptionWrite indexer to diskTODO: Need to check for thread safety
- Throws:
IOExceptionJAXBException
-
getCoverageName
public Name getCoverageName(String varName)
Return aNamerepresentation of the coverage name
-
dispose
public void dispose()
Dispose the Manager
-
getSlice2DIndex
public Slice2DIndex getSlice2DIndex(int imageIndex) throws IOException
Return aSlice2DIndexrelated to the provided imageIndex- Throws:
IOException
-
getSlicesIndexFile
public File getSlicesIndexFile()
-
getIndexerFile
public File getIndexerFile()
-
getDestinationDir
public File getDestinationDir()
-
getDatastoreIndexFile
public File getDatastoreIndexFile()
-
addSlice
public void addSlice(Slice2DIndex variableIndex)
-
addCoverage
public Indexer.Coverages.Coverage addCoverage(String varName)
-
initSliceManager
public void initSliceManager() throws IOException- Throws:
IOException
-
resetSliceManager
public void resetSliceManager() throws IOException- Throws:
IOException
-
getCoveragesNames
public List<Name> getCoveragesNames()
Get the list of Names for the underlying coverage list
-
initIndexer
protected void initIndexer() throws JAXBExceptionRetrieve basic indexer properties by scanning the indexer XML instance.- Throws:
JAXBException
-
getTypeName
public String getTypeName(String coverageName)
Returns the schema definition name for a given coverage (the schema definition name is not normally used in the database, which uses the coverage name instead)
-
setSchema
public String setSchema(Indexer.Coverages.Coverage coverage, String schemaName, String schemaDef)
Add the default schema to this coverage
-
acceptsVariable
public boolean acceptsVariable(String varName)
-
isImposedSchema
public boolean isImposedSchema()
-
addFile
public void addFile(String filePath)
Description copied from interface:FileSetManagerAdd a file to the file set manager- Specified by:
addFilein interfaceFileSetManager
-
list
public List<String> list()
Description copied from interface:FileSetManagerReturn the list of all the files currently added to the manager- Specified by:
listin interfaceFileSetManager
-
removeFile
public void removeFile(String filePath)
Description copied from interface:FileSetManagerRemove a file from the manager (An implementation may also physically remove the file)- Specified by:
removeFilein interfaceFileSetManager
-
purge
public void purge()
Description copied from interface:FileSetManagerRemove all the files from the manager (An implementation may also physically remove all the files)- Specified by:
purgein interfaceFileSetManager
-
convertToHex
public static String convertToHex(byte[] data)
-
getDatastoreConfiguration
public DataStoreConfiguration getDatastoreConfiguration() throws IOException
Create theDataStoreConfigurationusing the external datastoreIndexFile if provided, or the H2 based default.- Throws:
IOException
-
getParameterAsBoolean
public boolean getParameterAsBoolean(String parameterKey)
-
clearCache
public static void clearCache()
Clear the parsed configs (datastore and indexer) cache
-
-