Package org.geotools.data
Class DefaultRepository
Object
DefaultRepository
- All Implemented Interfaces:
Repository
Default Repository implementation allows GeoTools to manage your DataStores.
To use this implementation you can "registery" new DataStores:
- load( File )
- This also serves as a reminder that we need CrossDataStore functionality - at least for Locks. And possibly for "Query".
- Author:
- Jody Garnett DefaultRepository.java $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<Name,
DataAccess<?, ?>> Holds the DataStores so we can clean up when closed -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDataAccess<?,
?> DataAccess<?,
?> Search for the DataAccess (may be a DataStore) by name.Search for the DataStore by name.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.getNames()
void
Load a quick repository from a properties file.boolean
lockExists
(String lockID) Check if a lock exists in any of the DataStores.boolean
lockRefresh
(String lockID, Transaction transaction) Implement lockRefresh.boolean
lockRelease
(String lockID, Transaction transaction) Implement lockRelease.void
register
(String name, DataAccess<?, ?> dataStore) Register a new DataStore with this registeryvoid
register
(Name name, DataAccess<?, ?> dataStore)
-
Field Details
-
repository
Holds the DataStores so we can clean up when closed
-
-
Constructor Details
-
DefaultRepository
public DefaultRepository()
-
-
Method Details
-
access
-
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
-
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)
-
load
Load a quick repository from a properties file.This is useful for test cases; the format is:
nameA=param=value,param2=value2,... nameB=param=value,param2=value2,...
- Throws:
Exception
-
lockExists
Check if a lock exists in any of the DataStores. -
lockRefresh
Implement lockRefresh.Currently it is an error if the lockID is not found. Because if we can't find it we cannot refresh it.
Since locks are time sensitive it is impossible to check if a lockExists and then be sure it will still exist when you try to refresh it. Nothing we do can protect client code from this fact, they will need to do with the IOException when (not if) this situation occurs.
- Parameters:
lockID
- Authorizataion of lock to refreshtransaction
- Transaction used to authorize refresh- Throws:
IOException
- If opperation encounters problems, or lock not foundIllegalArgumentException
- if lockID isnull
- See Also:
-
org.geotools.data.Catalog#lockRefresh(java.lang.String, Transaction)
-
lockRelease
Implement lockRelease.Currently it is not and error if the lockID is not found, it may have expired. Since locks are time sensitive it is impossible to check if a lockExists and then be sure it will still exist when you try to release it.
- Parameters:
lockID
- Authorizataion of lock to refreshtransaction
- Transaction used to authorize refresh- Throws:
IOException
- If opperation encounters problemsIllegalArgumentException
- if lockID isnull
- See Also:
-
org.geotools.data.Catalog#lockRefresh(java.lang.String, Transaction)
-
register
Register a new DataStore with this registeryDescription ...
- Throws:
IOException
- See Also:
-
org.geotools.data.Catalog#registerDataStore(DataStore)
-
register
- Throws:
IOException
-
datastore
-
source
- Throws:
IOException
-
getNames
-
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
-