org.geotools.data
Class DefaultCatalog

java.lang.Object
  extended byorg.geotools.data.DefaultCatalog
All Implemented Interfaces:
Catalog

public class DefaultCatalog
extends java.lang.Object
implements Catalog

Simple Catalog so we can try out the api.

This class intends to track the Catalog API as it provides more metadata information. It is intended to be an In Memory data structure.

Other projectswill produce more persistent Catalog implementations. GeoServer for instance will back it's Catalog implementation with XML files.

Author:
Jody Garnett, Refractions Research

Field Summary
protected  java.util.Map registration
           
 
Constructor Summary
DefaultCatalog()
           
 
Method Summary
 DataStore getDataStore(java.lang.String namespace)
          Retrieve DataStore managed by this Catalog.
 java.lang.String[] getNameSpaces()
          Retrieve registered Namespaces.
 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.util.Map params)
          Finds and registers DataStore indicated by the parameters.
 void registerDataStore(java.lang.String namespace, DataStore dataStore)
          Registrers datastore with the provided namespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

registration

protected java.util.Map registration
Constructor Detail

DefaultCatalog

public DefaultCatalog()
Method Detail

getNameSpaces

public java.lang.String[] getNameSpaces()
Description copied from interface: Catalog
Retrieve registered Namespaces.

Specified by:
getNameSpaces in interface Catalog
Returns:
List of available namespaces

registerDataStore

public void registerDataStore(java.lang.String namespace,
                              DataStore dataStore)
Registrers datastore with the provided namespace.

Specified by:
registerDataStore in interface Catalog
Parameters:
namespace -
dataStore -
See Also:
Catalog.registerDataStore(java.lang.String, org.geotools.data.DataStore)

register

public void register(java.util.Map params)
              throws java.io.IOException
Finds and registers DataStore indicated by the parameters.

The provided parameters must specify a namespace for the resulting DataStore.

Parameters:
params -
Throws:
java.io.IOException

getDataStore

public DataStore getDataStore(java.lang.String namespace)
Retrieve DataStore managed by this Catalog.

Specified by:
getDataStore in interface Catalog
Parameters:
namespace -
Returns:
See Also:
Catalog.getDataStore(java.lang.String)

lockExists

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

Specified by:
lockExists in interface Catalog
Parameters:
lockID -
Returns:
true if lock was found
See Also:
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 Catalog
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:
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 Catalog
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:
Catalog.lockRefresh(java.lang.String, org.geotools.data.Transaction)


Copyright © 1996-2003 GeoTools. All Rights Reserved.