public class DefaultRepository extends Object implements Repository
To use this implementation you can "registery" new DataStores:
Modifier and Type | Field and Description |
---|---|
protected Map<Name,DataAccess<?,?>> |
repository
Holds the DataStores so we can clean up when closed
|
Constructor and Description |
---|
DefaultRepository() |
Modifier and Type | Method and Description |
---|---|
DataAccess<?,?> |
access(Name name)
Search for the DataAccess (may be a DataStore) by name.
|
DataAccess<?,?> |
access(String name) |
DataStore |
dataStore(Name name)
Search for the DataStore by name.
|
DataStore |
datastore(String id) |
DataStore |
dataStore(String 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() |
void |
load(File propertiesFile)
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(Name name,
DataAccess<?,?> dataStore) |
void |
register(String name,
DataAccess<?,?> dataStore)
Register a new DataStore with this registery
Description ...
|
SimpleFeatureSource |
source(String dataStoreId,
String typeName) |
protected Map<Name,DataAccess<?,?>> repository
public DataAccess<?,?> access(String name)
public DataAccess<?,?> access(Name name)
Repository
access
in interface Repository
name
- The Name (namespace and name) to search forpublic DataStore dataStore(Name name)
Repository
dataStore
in interface Repository
public void load(File propertiesFile) throws Exception
This is useful for test cases; the format is:
nameA=param=value,param2=value2,...
nameB=param=value,param2=value2,...
public boolean lockExists(String lockID)
lockID
- public boolean lockRefresh(String lockID, Transaction transaction) throws IOException
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.
lockID
- Authorizataion of lock to refreshtransaction
- Transaction used to authorize refreshIOException
- If opperation encounters problems, or lock not foundIllegalArgumentException
- if lockID is null
org.geotools.data.Catalog#lockRefresh(java.lang.String, org.geotools.data.Transaction)
public boolean lockRelease(String lockID, Transaction transaction) throws IOException
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.
lockID
- Authorizataion of lock to refreshtransaction
- Transaction used to authorize refreshIOException
- If opperation encounters problemsIllegalArgumentException
- if lockID is null
org.geotools.data.Catalog#lockRefresh(java.lang.String, org.geotools.data.Transaction)
public void register(String name, DataAccess<?,?> dataStore) throws IOException
Description ...
String
- namespace Namespace todataStore
- IOException
org.geotools.data.Catalog#registerDataStore(org.geotools.data.DataStore)
public void register(Name name, DataAccess<?,?> dataStore) throws IOException
IOException
public SimpleFeatureSource source(String dataStoreId, String typeName) throws IOException
IOException
public List<DataStore> getDataStores()
Repository
getDataStores
in interface Repository
Copyright © 1996–2019 Geotools. All rights reserved.