Package org.geotools.data
Class DefaultRepository
- Object
-
- DefaultRepository
-
- All Implemented Interfaces:
Repository
public class DefaultRepository extends Object implements 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
Fields Modifier and Type Field Description protected Map<Name,DataAccess<?,?>>repositoryHolds the DataStores so we can clean up when closed
-
Constructor Summary
Constructors Constructor Description DefaultRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataAccess<?,?>access(String name)DataAccess<?,?>access(Name name)Search for the DataAccess (may be a DataStore) by name.DataStoredatastore(String id)DataStoredataStore(String name)DataStoredataStore(Name name)Search for the DataStore by name.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.Set<Name>getNames()voidload(File propertiesFile)Load a quick repository from a properties file.booleanlockExists(String lockID)Check if a lock exists in any of the DataStores.booleanlockRefresh(String lockID, Transaction transaction)Implement lockRefresh.booleanlockRelease(String lockID, Transaction transaction)Implement lockRelease.voidregister(String name, DataAccess<?,?> dataStore)Register a new DataStore with this registeryvoidregister(Name name, DataAccess<?,?> dataStore)SimpleFeatureSourcesource(String dataStoreId, String typeName)
-
-
-
Field Detail
-
repository
protected Map<Name,DataAccess<?,?>> repository
Holds the DataStores so we can clean up when closed
-
-
Method Detail
-
access
public DataAccess<?,?> access(String name)
-
access
public DataAccess<?,?> access(Name name)
Description copied from interface:RepositorySearch for the DataAccess (may be a DataStore) by name.- Specified by:
accessin interfaceRepository- Parameters:
name- The Name (namespace and name) to search for- Returns:
- DataAccess
-
dataStore
public DataStore dataStore(Name name)
Description copied from interface:RepositorySearch for the DataStore by name.- Specified by:
dataStorein 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
public void load(File propertiesFile) throws Exception
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
public boolean lockExists(String lockID)
Check if a lock exists in any of the DataStores.
-
lockRefresh
public boolean lockRefresh(String lockID, Transaction transaction) throws IOException
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
public boolean lockRelease(String lockID, Transaction transaction) throws IOException
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
public void register(String name, DataAccess<?,?> dataStore) throws IOException
Register a new DataStore with this registeryDescription ...
- Throws:
IOException- See Also:
org.geotools.data.Catalog#registerDataStore(DataStore)
-
register
public void register(Name name, DataAccess<?,?> dataStore) throws IOException
- Throws:
IOException
-
source
public SimpleFeatureSource source(String dataStoreId, String typeName) throws IOException
- Throws:
IOException
-
getDataStores
public List<DataStore> getDataStores()
Description copied from interface:RepositoryList 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:
getDataStoresin interfaceRepository- Returns:
- List of Managed DataStore instances
-
-