org.geotools.data
Class DefaultRepository

java.lang.Object
  extended byorg.geotools.data.DefaultRepository
All Implemented Interfaces:
Repository

public class DefaultRepository
extends java.lang.Object
implements Repository

Quick hack of a DataRepository allows me to bridge the existing DataStore API with these experiments for a Opperations api. I have used the old DefaultCatalaog as a starting point. This also serves as a reminder that we need CrossDataStore functionality - at least for Locks. And possibly for "Query".

Author:
Jody Garnett

Field Summary
protected  java.util.SortedMap datastores
          Map of DataStore by dataStoreId
 
Constructor Summary
DefaultRepository()
           
 
Method Summary
 DataStore datastore(java.lang.String id)
          Implement getDataStores.
 java.util.Map getDataStores()
          Access to the set of registered DataStores.
 java.util.SortedMap getFeatureSources()
          All FeatureSources by typeRef ( aka dataStoreId:typeName)
 java.util.Set getPrefixes()
          Retrieve prefix set.
 void load(java.io.File propertiesFile)
          Load a quick datastore definition from a properties file.
 boolean lockExists(java.lang.String lockID)
          Implement lockExists.
 boolean lockRefresh(java.lang.String lockID, Transaction transaction)
          Implement lockRefresh.
 boolean lockRelease(java.lang.String lockID, Transaction transaction)
          Implement lockRelease.
 void register(java.lang.String id, DataStore dataStore)
          Implement registerDataStore.
 FeatureSource source(java.lang.String dataStoreId, java.lang.String typeName)
          FeatureSoruce access.
 java.util.SortedMap types()
          All FeatureTypes by dataStoreId:typeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datastores

protected java.util.SortedMap datastores
Map of DataStore by dataStoreId

Constructor Detail

DefaultRepository

public DefaultRepository()
Method Detail

load

public void load(java.io.File propertiesFile)
          throws java.lang.Exception
Load a quick datastore definition from a properties file.

This is useful for test cases.

Throws:
java.io.IOException
java.io.FileNotFoundException
java.lang.Exception

getFeatureSources

public java.util.SortedMap getFeatureSources()
Description copied from interface: Repository
All FeatureSources by typeRef ( aka dataStoreId:typeName)

Specified by:
getFeatureSources in interface Repository

getPrefixes

public java.util.Set getPrefixes()
                          throws java.io.IOException
Retrieve prefix set.

Specified by:
getPrefixes in interface Repository
Returns:
Set of namespace prefixes
Throws:
java.io.IOException
See Also:
org.geotools.data.Catalog#getPrefixes()

types

public java.util.SortedMap types()
                          throws java.io.IOException
All FeatureTypes by dataStoreId:typeName

Throws:
java.io.IOException

lockExists

public boolean lockExists(java.lang.String lockID)
Implement lockExists.

Specified by:
lockExists in interface Repository
Parameters:
lockID -
Returns:
true if lock was found
See Also:
org.geotools.data.Catalog#lockExists(java.lang.String)

lockRefresh

public boolean lockRefresh(java.lang.String lockID,
                           Transaction transaction)
                    throws java.io.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.

Specified by:
lockRefresh in interface Repository
Parameters:
lockID - Authorizataion of lock to refresh
transaction - Transaction used to authorize refresh
Returns:
true if lock was found and refreshed
Throws:
java.io.IOException - If opperation encounters problems, or lock not found
java.lang.IllegalArgumentException - if lockID is null
See Also:
org.geotools.data.Catalog#lockRefresh(java.lang.String, org.geotools.data.Transaction)

lockRelease

public boolean lockRelease(java.lang.String lockID,
                           Transaction transaction)
                    throws java.io.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.

Specified by:
lockRelease in interface Repository
Parameters:
lockID - Authorizataion of lock to refresh
transaction - Transaction used to authorize refresh
Returns:
true if lock was found and released
Throws:
java.io.IOException - If opperation encounters problems
java.lang.IllegalArgumentException - if lockID is null
See Also:
org.geotools.data.Catalog#lockRefresh(java.lang.String, org.geotools.data.Transaction)

register

public void register(java.lang.String id,
                     DataStore dataStore)
              throws java.io.IOException
Implement registerDataStore.

Description ...

Parameters:
dataStore -
Throws:
java.io.IOException
See Also:
org.geotools.data.Catalog#registerDataStore(org.geotools.data.DataStore)

datastore

public DataStore datastore(java.lang.String id)
Implement getDataStores.

Description ...

Returns:
See Also:
org.geotools.data.Catalog#getDataStores(java.lang.String)

getDataStores

public java.util.Map getDataStores()
Access to the set of registered DataStores.

The provided Set may not be modified :-)

Specified by:
getDataStores in interface Repository
Returns:
See Also:
org.geotools.data.Catalog#getDataStores(java.lang.String)

source

public FeatureSource source(java.lang.String dataStoreId,
                            java.lang.String typeName)
                     throws java.io.IOException
Description copied from interface: Repository
FeatureSoruce access.

Specified by:
source in interface Repository
Parameters:
dataStoreId -
typeName -
Returns:
Throws:
java.io.IOException


Copyright © GeoTools. All Rights Reserved.