Package org.geotools.data.complex
Class DataAccessRegistry
Object
DataAccessRegistry
- All Implemented Interfaces:
Repository
- Direct Known Subclasses:
AppSchemaDataAccessRegistry
A registry that stores data access instances per application. This allows feature sources from different data
accesses to be accessed globally.
- Author:
- Rini Angreani (CSIRO Earth Science and Resource Engineering), Niels Charlier (Curtin University Of Technology)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InterpolationProperties
Properties for interpolation / configuration settingsprotected List<DataAccess<FeatureType,
Feature>> Data Access Resourcesprotected static DataAccessRegistry
Singleton instance -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSearch for the DataAccess (may be a DataStore) by name.void
Clean-up properties, mainly used for cleaning up after testsSearch for the DataStore by name.void
Dispose and unregister all data accesses in the registry.featureSource
(Name name) Get a feature source for built features with supplied feature type name.findFeature
(FeatureId id, Hints hints) static DataAccess<FeatureType,
Feature> getDataAccess
(Name featureTypeName) List of available DataStore instances; these are considered to be live/connected datastores under the management of the application and should not be closed or otherwise harmed by client code.static FeatureSource<FeatureType,
Feature> getFeatureSource
(Name featureTypeName) Get a feature source for built features with supplied feature type name.static DataAccessRegistry
Public method to get singleton instance to registry.Get propertiesboolean
hasAccessName
(Name name) Return true if a type name is mapped in one of the registered data accesses.boolean
hasAppSchemaAccessName
(Name name) Return true if a type name is mapped in one of the registered app-schema data accesses.boolean
Return true if a type name is mapped in one of the registered app-schema data accesses as targetElementName, regardless whether or not mappingName exists.static boolean
Return true if a type name is mapped in one of the registered data accesses.mappingByElement
(Name name) mappingByName
(Name name) Get a feature type mapping from a registered app-schema data access.static void
register
(DataAccess<FeatureType, Feature> dataAccess) Registers a data accessvoid
registerAccess
(DataAccess<FeatureType, Feature> dataAccess) Registers a data accessprotected void
throwDataSourceException
(Name featureTypeName) Throws data source exception if mapping is not found.static void
unregister
(DataAccess<FeatureType, Feature> dataAccess) Unregister a data access.void
unregisterAccess
(DataAccess<FeatureType, Feature> dataAccess) Unregister a data access.static void
Unregister * and dispose * all data accesses in the registry.
-
Field Details
-
theRegistry
Singleton instance -
properties
Properties for interpolation / configuration settings -
registry
Data Access Resources
-
-
Constructor Details
-
DataAccessRegistry
protected DataAccessRegistry()Sole constructor
-
-
Method Details
-
getInstance
Public method to get singleton instance to registry.- Returns:
- An instance of this class
-
featureSource
Get a feature source for built features with supplied feature type name.- Returns:
- feature source
- Throws:
IOException
-
access
Description copied from interface:Repository
Search for the DataAccess (may be a DataStore) by name.- Specified by:
access
in interfaceRepository
- Parameters:
name
- The Name (namespace and name) to search for- Returns:
- DataAccess
-
dataStore
Description copied from interface:Repository
Search for the DataStore by name.- Specified by:
dataStore
in interfaceRepository
- Parameters:
name
- The typeName (namespace and name) to search for- Returns:
- DataAccess api providing access to the indicatedTypeName (or null if not found)
-
getDataStores
Description copied from interface:Repository
List of available DataStore instances; these are considered to be live/connected datastores under the management of the application and should not be closed or otherwise harmed by client code.- Specified by:
getDataStores
in interfaceRepository
- Returns:
- List of Managed DataStore instances
-
registerAccess
Registers a data access- Parameters:
dataAccess
- Data access to be registered
-
unregisterAccess
Unregister a data access. This is important especially at the end of test cases, so that the mappings contained in the data access do not conflict with mappings of the same type used in other tests.- Parameters:
dataAccess
- Data access to be unregistered
-
disposeAndUnregisterAll
public void disposeAndUnregisterAll()Dispose and unregister all data accesses in the registry. This is may be needed to prevent unit tests from conflicting with data accesses with the same type name registered for other tests. -
hasAccessName
Return true if a type name is mapped in one of the registered data accesses. If the type mapping has mappingName, then it will be the key that is matched in the search. If it doesn't, then it will match the targetElementName.- Parameters:
name
- Feature type name- Throws:
IOException
-
hasAppSchemaAccessName
Return true if a type name is mapped in one of the registered app-schema data accesses. If the type mapping has mappingName, then it will be the key that is matched in the search. If it doesn't, then it will match the targetElementName.- Parameters:
name
- Feature type name- Throws:
IOException
-
mappingByName
Get a feature type mapping from a registered app-schema data access. Please note that this is only possible for app-schema data access instances.- Returns:
- feature type mapping
- Throws:
IOException
-
mappingByElement
- Throws:
IOException
-
hasAppSchemaTargetElement
Return true if a type name is mapped in one of the registered app-schema data accesses as targetElementName, regardless whether or not mappingName exists.- Throws:
IOException
-
getProperties
Get properties- Returns:
- properties
-
clearProperties
public void clearProperties()Clean-up properties, mainly used for cleaning up after tests -
getFeatureSource
public static FeatureSource<FeatureType,Feature> getFeatureSource(Name featureTypeName) throws IOException Get a feature source for built features with supplied feature type name.- Returns:
- feature source
- Throws:
IOException
-
getDataAccess
public static DataAccess<FeatureType,Feature> getDataAccess(Name featureTypeName) throws IOException - Throws:
IOException
-
register
Registers a data access- Parameters:
dataAccess
- Data access to be registered
-
unregister
Unregister a data access. This is important especially at the end of test cases, so that the mappings contained in the data access do not conflict with mappings of the same type used in other tests. * Does not dispose * This method should not be called directly, instead use dispose method from DataAccess- Parameters:
dataAccess
- Data access to be unregistered
-
unregisterAndDisposeAll
public static void unregisterAndDisposeAll()Unregister * and dispose * all data accesses in the registry. This is may be needed to prevent unit tests from conflicting with data accesses with the same type name registered for other tests. -
hasName
Return true if a type name is mapped in one of the registered data accesses. If the type mapping has mappingName, then it will be the key that is matched in the search. If it doesn't, then it will match the targetElementName.- Parameters:
featureTypeName
- Feature type name- Throws:
IOException
-
throwDataSourceException
Throws data source exception if mapping is not found.- Parameters:
featureTypeName
- Name of feature type- Throws:
IOException
-
findFeature
- Throws:
IOException
-