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_CACHE
protected 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 boolean
acceptsVariable(String varName)
Indexer.Coverages.Coverage
addCoverage(String varName)
void
addFile(String filePath)
Add a file to the file set managervoid
addSlice(Slice2DIndex variableIndex)
static void
clearCache()
Clear the parsed configs (datastore and indexer) cachestatic String
convertToHex(byte[] data)
void
dispose()
Dispose the ManagerName
getCoverageName(String varName)
Return aName
representation of the coverage nameList<Name>
getCoveragesNames()
Get the list of Names for the underlying coverage listDataStoreConfiguration
getDatastoreConfiguration()
Create theDataStoreConfiguration
using the external datastoreIndexFile if provided, or the H2 based default.File
getDatastoreIndexFile()
File
getDestinationDir()
File
getIndexerFile()
String
getParameter(String parameterKey)
boolean
getParameterAsBoolean(String parameterKey)
Slice2DIndex
getSlice2DIndex(int imageIndex)
Return aSlice2DIndex
related to the provided imageIndexFile
getSlicesIndexFile()
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)protected void
initIndexer()
Retrieve basic indexer properties by scanning the indexer XML instance.void
initSliceManager()
boolean
isImposedSchema()
List<String>
list()
Return the list of all the files currently added to the managervoid
purge()
Remove all the files from the manager (An implementation may also physically remove all the files)void
removeFile(String filePath)
Remove a file from the manager (An implementation may also physically remove the file)void
resetSliceManager()
String
setSchema(Indexer.Coverages.Coverage coverage, String schemaName, String schemaDef)
Add the default schema to this coveragevoid
writeToDisk()
Write indexer to disk
-
-
-
Constructor Detail
-
AncillaryFileManager
public AncillaryFileManager(File netcdfFile, String indexFilePath) throws IOException, JAXBException, NoSuchAlgorithmException
- Throws:
IOException
JAXBException
NoSuchAlgorithmException
-
AncillaryFileManager
public AncillaryFileManager(File netcdfFile, String indexFilePath, String datastoreFilePath) throws IOException, JAXBException, NoSuchAlgorithmException
- Throws:
IOException
JAXBException
NoSuchAlgorithmException
-
-
Method Detail
-
writeToDisk
public void writeToDisk() throws IOException, JAXBException
Write indexer to diskTODO: Need to check for thread safety
- Throws:
IOException
JAXBException
-
getCoverageName
public Name getCoverageName(String varName)
Return aName
representation of the coverage name
-
dispose
public void dispose()
Dispose the Manager
-
getSlice2DIndex
public Slice2DIndex getSlice2DIndex(int imageIndex) throws IOException
Return aSlice2DIndex
related 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 JAXBException
Retrieve 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:FileSetManager
Add a file to the file set manager- Specified by:
addFile
in interfaceFileSetManager
-
list
public List<String> list()
Description copied from interface:FileSetManager
Return the list of all the files currently added to the manager- Specified by:
list
in interfaceFileSetManager
-
removeFile
public void removeFile(String filePath)
Description copied from interface:FileSetManager
Remove a file from the manager (An implementation may also physically remove the file)- Specified by:
removeFile
in interfaceFileSetManager
-
purge
public void purge()
Description copied from interface:FileSetManager
Remove all the files from the manager (An implementation may also physically remove all the files)- Specified by:
purge
in interfaceFileSetManager
-
convertToHex
public static String convertToHex(byte[] data)
-
getDatastoreConfiguration
public DataStoreConfiguration getDatastoreConfiguration() throws IOException
Create theDataStoreConfiguration
using 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
-
-