org.geotools.data.complex
Class DataAccessRegistry

Object
  extended by DataAccessRegistry
All Implemented Interfaces:
Repository
Direct Known Subclasses:
AppSchemaDataAccessRegistry

public class DataAccessRegistry
extends Object
implements Repository

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
protected  InterpolationProperties properties
          Properties for interpolation / configuration settings
protected  List<DataAccess<FeatureType,Feature>> registry
          Data Access Resources
protected static DataAccessRegistry theRegistry
          Singleton instance
 
Constructor Summary
protected DataAccessRegistry()
          Sole constructor
 
Method Summary
 DataAccess<FeatureType,Feature> access(Name name)
          Search for the DataAccess (may be a DataStore) by name.
 void clearProperties()
          Clean-up properties, mainly used for cleaning up after tests
 DataStore dataStore(Name name)
          Search for the DataStore by name.
 void disposeAndUnregisterAll()
          Dispose and unregister all data accesses in the registry.
 FeatureSource<FeatureType,Feature> featureSource(Name name)
          Get a feature source for built features with supplied feature type name.
 Feature findFeature(FeatureId id, Hints hints)
           
static DataAccess<FeatureType,Feature> getDataAccess(Name featureTypeName)
           
 List<DataStore> getDataStores()
          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 getInstance()
          Public method to get singleton instance to registry.
 InterpolationProperties getProperties()
          Get properties
 boolean 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 hasAppSchemaTargetElement(Name name)
          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 hasName(Name featureTypeName)
          Return true if a type name is mapped in one of the registered data accesses.
 FeatureTypeMapping mappingByElement(Name name)
           
 FeatureTypeMapping 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 access
 void registerAccess(DataAccess<FeatureType,Feature> dataAccess)
          Registers a data access
protected  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 unregisterAll()
          Deprecated. 
static void unregisterAndDisposeAll()
          Unregister * and dispose * all data accesses in the registry.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theRegistry

protected static DataAccessRegistry theRegistry
Singleton instance


properties

protected InterpolationProperties properties
Properties for interpolation / configuration settings


registry

protected List<DataAccess<FeatureType,Feature>> registry
Data Access Resources

Constructor Detail

DataAccessRegistry

protected DataAccessRegistry()
Sole constructor

Method Detail

getInstance

public static DataAccessRegistry getInstance()
Public method to get singleton instance to registry.

Returns:
An instance of this class

featureSource

public FeatureSource<FeatureType,Feature> featureSource(Name name)
                                                 throws IOException
Get a feature source for built features with supplied feature type name.

Parameters:
featureTypeName -
Returns:
feature source
Throws:
IOException

access

public DataAccess<FeatureType,Feature> access(Name name)
Description copied from interface: Repository
Search for the DataAccess (may be a DataStore) by name.

Specified by:
access in interface Repository
Parameters:
name - The Name (namespace and name) to search for
Returns:
DataAccess

dataStore

public DataStore dataStore(Name name)
Description copied from interface: Repository
Search for the DataStore by name.

Specified by:
dataStore in interface Repository
Returns:
DataAccess api providing access to the indicatedTypeName (or null if not found)

getDataStores

public List<DataStore> 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 interface Repository
Returns:
List of Managed DataStore instances

registerAccess

public void registerAccess(DataAccess<FeatureType,Feature> dataAccess)
Registers a data access

Parameters:
dataAccess - Data access to be registered

unregisterAccess

public void unregisterAccess(DataAccess<FeatureType,Feature> dataAccess)
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

public boolean hasAccessName(Name name)
                      throws IOException
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
Returns:
Throws:
IOException

hasAppSchemaAccessName

public boolean hasAppSchemaAccessName(Name name)
                               throws IOException
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:
featureTypeName - Feature type name
Returns:
Throws:
IOException

mappingByName

public FeatureTypeMapping mappingByName(Name name)
                                 throws IOException
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.

Parameters:
featureTypeName -
Returns:
feature type mapping
Throws:
IOException

mappingByElement

public FeatureTypeMapping mappingByElement(Name name)
                                    throws IOException
Throws:
IOException

hasAppSchemaTargetElement

public boolean hasAppSchemaTargetElement(Name name)
                                  throws IOException
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.

Parameters:
featureTypeName -
Returns:
Throws:
IOException

getProperties

public InterpolationProperties 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.

Parameters:
featureTypeName -
Returns:
feature source
Throws:
IOException

getDataAccess

public static DataAccess<FeatureType,Feature> getDataAccess(Name featureTypeName)
                                                     throws IOException
Throws:
IOException

register

public static void register(DataAccess<FeatureType,Feature> dataAccess)
Registers a data access

Parameters:
dataAccess - Data access to be registered

unregister

public static void unregister(DataAccess<FeatureType,Feature> dataAccess)
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.


unregisterAll

@Deprecated
public static void unregisterAll()
Deprecated. 

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

public static boolean hasName(Name featureTypeName)
                       throws IOException
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
Returns:
Throws:
IOException

throwDataSourceException

protected void throwDataSourceException(Name featureTypeName)
                                 throws IOException
Throws data source exception if mapping is not found.

Parameters:
featureTypeName - Name of feature type
Throws:
IOException

findFeature

public Feature findFeature(FeatureId id,
                           Hints hints)
                    throws IOException
Throws:
IOException


Copyright © 1996-2014 Geotools. All Rights Reserved.