org.deegree.cs.persistence
Class AbstractCRSStore

java.lang.Object
  extended by org.deegree.cs.persistence.AbstractCRSStore
Type Parameters:
T - the type of object the parse method awaits.
All Implemented Interfaces:
CRSStore
Direct Known Subclasses:
DBCRSStore, DeegreeCRSStore, GMLCRSStore, PROJ4CRSStore

public abstract class AbstractCRSStore
extends Object
implements CRSStore

The base class for a CRSStore which has a caching mechanism for CRSIdentifiables and instantiates a given resolver used for inverse lookup.

Version:
$Revision: 30798 $, $Date: 2011-05-12 16:31:53 +0200 (Thu, 12 May 2011) $
Author:
Rutger Bezema

Nested Class Summary
static class AbstractCRSStore.RESOURCETYPE
           
 
Constructor Summary
AbstractCRSStore(TransformationFactory.DSTransform prefTransformType)
           
 
Method Summary
<V extends CRSResource>
V
addIdToCache(V resource, boolean update)
          Add the id to the cache, by mapping it to all its identifiers.
 void clearCache()
          Clears the cache.
<V extends CRSResource>
V
getCachedIdentifiable(Class<V> expectedType, CRSCodeType[] ids)
          Get a CRSIdentifiable (actually a type V that extends it) from the cache that corresponds to the a CRSCodeType.
<V extends CRSResource>
V
getCachedIdentifiable(Class<V> expectedType, CRSResource ids)
          The id are what they are, not trimming 'upcasing' or other modifications will be done in this method.
<V extends CRSResource>
V
getCachedIdentifiable(Class<V> expectedType, String id)
          The id is as it is, not trimming 'upcasing' or other modifications will be done in this method.
<V extends CRSResource>
V
getCachedIdentifiable(Class<V> expectedType, String[] ids)
          The id are what they are, not trimming 'upcasing' or other modifications will be done in this method.
<V extends CRSResource>
V
getCachedIdentifiable(CRSCodeType id)
          Get a CRSIdentifiable (actually a type V that extends it) from the cache that corresponds to the a CRSCodeType.
<V extends CRSResource>
V
getCachedIdentifiable(String id)
          The id is as it is, not trimming 'upcasing' or other modifications will be done in this method.
abstract  ICRS getCoordinateSystem(String id)
           
 ICRS getCRSByCode(CRSCodeType id)
          Retrieves the ICRS from the set provider that is identified by the given CRSCodeType id.
 ICRS getCRSByCode(CRSCodeType id, boolean forceXY)
           
 TransformationFactory.DSTransform getPreferedTransformationType()
           
protected  ICRS resolve(ICRS crs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deegree.cs.persistence.CRSStore
getAvailableCRSCodes, getAvailableCRSs, getCRSResource, getDirectTransformation, getDirectTransformation, init
 

Constructor Detail

AbstractCRSStore

public AbstractCRSStore(TransformationFactory.DSTransform prefTransformType)
Parameters:
prefTransformType - the preferred TransformationFactory.DSTransform type how to transform from this CRSStore
Method Detail

getCRSByCode

public ICRS getCRSByCode(CRSCodeType id)
                  throws CRSConfigurationException
Retrieves the ICRS from the set provider that is identified by the given CRSCodeType id.

Specified by:
getCRSByCode in interface CRSStore
Parameters:
id - the CRSCodeType of the wanted crs
Returns:
the ICRS that corresponds to the id
Throws:
CRSConfigurationException

getCRSByCode

public ICRS getCRSByCode(CRSCodeType id,
                         boolean forceXY)
                  throws CRSConfigurationException
Specified by:
getCRSByCode in interface CRSStore
Parameters:
id - string representation of the CoordinateSystem
forceXY - true if the axis order of the coordinate system should be x/y (EAST/NORTH; WEST/SOUTH); false if the defined axis order should be used
Returns:
the identified CRS or null if no such CRS was found.
Throws:
CRSConfigurationException - if the implementation was confronted by an exception and could not deliver the requested crs. This exception should not be thrown if the given id wasn't found, in this case null should be returned.

clearCache

public void clearCache()
Clears the cache.


getCachedIdentifiable

public <V extends CRSResource> V getCachedIdentifiable(Class<V> expectedType,
                                                       CRSResource ids)
The id are what they are, not trimming 'upcasing' or other modifications will be done in this method.

Type Parameters:
V - the type to cast to if the casting fails, null will be returned.
Parameters:
expectedType - The class of type T which is expected.
ids - to search the cache for
Returns:
the CRSIdentifiable of the first matching id or null if it was not found.

getCachedIdentifiable

public <V extends CRSResource> V getCachedIdentifiable(Class<V> expectedType,
                                                       String[] ids)
The id are what they are, not trimming 'upcasing' or other modifications will be done in this method.

Type Parameters:
V - the type to cast to if the casting fails, null will be returned.
Parameters:
expectedType - The class of type T which is expected.
ids - to search the cache for
Returns:
the CRSIdentifiable of the first matching id or null if it was not found.

getCachedIdentifiable

public <V extends CRSResource> V getCachedIdentifiable(Class<V> expectedType,
                                                       CRSCodeType[] ids)
Get a CRSIdentifiable (actually a type V that extends it) from the cache that corresponds to the a CRSCodeType. An array of code types is given; the first identifiable that is found in (for a code, when they are checked in order) is returned

Type Parameters:
V -
Parameters:
expectedType - the type of the sought object
ids - an array of CRSCodeTypes
Returns:
the identifiable found in the cache corresponding to the (first) id

getCachedIdentifiable

public <V extends CRSResource> V getCachedIdentifiable(Class<V> expectedType,
                                                       String id)
The id is as it is, not trimming 'upcasing' or other modifications will be done in this method.

Type Parameters:
V - the type to cast to if the casting fails, null will be returned.
Parameters:
expectedType - The class of type T which is expected.
id - to search the cache for
Returns:
the CRSIdentifiable or null if it was not found or the wrong type was found.

getCachedIdentifiable

public <V extends CRSResource> V getCachedIdentifiable(String id)
The id is as it is, not trimming 'upcasing' or other modifications will be done in this method.

Type Parameters:
V - the type to cast to if the casting fails, null will be returned.
Parameters:
id - to search the cache for
Returns:
the CRSIdentifiable or null if it was not found or the wrong type was found.

getCachedIdentifiable

public <V extends CRSResource> V getCachedIdentifiable(CRSCodeType id)
Get a CRSIdentifiable (actually a type V that extends it) from the cache that corresponds to the a CRSCodeType.

Type Parameters:
V -
Parameters:
id - a CRSCodeType
Returns:
a CRSIdentifiable-extending object that corresponds to the given id

addIdToCache

public <V extends CRSResource> V addIdToCache(V resource,
                                              boolean update)
Add the id to the cache, by mapping it to all its identifiers.

Type Parameters:
V - type of CRSIdentifiable
Parameters:
resource - to insert into cache
update - if true an existing identifiable in the cache will be overwritten.
Returns:
the identifiable

getPreferedTransformationType

public TransformationFactory.DSTransform getPreferedTransformationType()
Specified by:
getPreferedTransformationType in interface CRSStore
Returns:
the prefered transformation type for this CRSStore

getCoordinateSystem

public abstract ICRS getCoordinateSystem(String id)
Parameters:
id -
Returns:

resolve

protected ICRS resolve(ICRS crs)


Copyright © 2011. All Rights Reserved.