deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.crs.configuration.deegree.db
Class DatabaseCRSProvider

java.lang.Object
  extended by org.deegree.crs.configuration.deegree.db.DatabaseCRSProvider
All Implemented Interfaces:
CRSProvider

public class DatabaseCRSProvider
extends Object
implements CRSProvider

The DatabaseCRSProvider class is the intermediate class for accessing the Deegree CRS via a database backend. It also initializes the CRSQuerier (for retrieving CRSs from database), CRSExported (for inserting CRSs to database) and CRSRemover (for removing CRSs from database). In the constructor the database connection is realized in read-only mode (by default, using the classpath subprotocol), but can be set so that database changes are possible (by setting the environment variable CRS_DB_URL). The JDBC driver is also set (CRS_DB_DRIVER variable), as well as the username and password.

Version:
$Revision: $, $Date: $
Author:
Andrei Ionita, last edited by: $Author: ionita $

Constructor Summary
DatabaseCRSProvider()
           
DatabaseCRSProvider(Properties properties)
           
 
Method Summary
 boolean canExport()
           
 void changeAxisCode(String axisName, String axisOrientation, Unit uom, CRSCodeType code)
          Method used by the synchronization-with-EPSG-database class to update the Axis with the EPSG code that it was lacking.
 void export(List<CoordinateSystem> crsList)
          Export a list of CoordianteSystems to the database
 void export(StringBuilder sb, List<CoordinateSystem> crsToExport)
          Exports the crs to the implemented format.
 List<CRSCodeType> getAvailableCRSCodes()
          This method should be called if one is only interested in the available identifiers and not in the coordinatesystems themselves.
 List<CoordinateSystem> getAvailableCRSs()
          This method should be called to see if the provider is able to create all defined crs's, thus verifying the correctness of the configuration.
 Connection getConnection()
           
 CoordinateSystem getCRSByCode(CRSCodeType code)
          Retrieves the CRS via its code
 CRSIdentifiable getIdentifiable(CRSCodeType id)
          This method is more general than the CRSProvider.getCRSByCode(CRSCodeType), because it represents a possibility to return an arbitrary CRSIdentifiable Object from the providers backend.
 int getInternalID(CRSIdentifiable identifiable)
          Retrieve the internal database ID for the object supplied
 CRSRemover getRemover()
           
 Transformation getTransformation(CoordinateSystem sourceCRS, CoordinateSystem targetCRS)
          This method is should retrieve a transformation (chain) which transforms coordinates from the given source into the given target crs.
 void remove(List<CoordinateSystem> crsList)
           
 void setCode(int internalID, String code)
          Request an Update into the database for a new Code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseCRSProvider

public DatabaseCRSProvider()
                    throws CRSConfigurationException
Throws:
CRSConfigurationException

DatabaseCRSProvider

public DatabaseCRSProvider(Properties properties)
                    throws CRSConfigurationException
Parameters:
properties -
Throws:
CRSConfigurationException
Method Detail

getInternalID

public int getInternalID(CRSIdentifiable identifiable)
Retrieve the internal database ID for the object supplied

Parameters:
identifiable - the CRSIdentifiable object
Returns:
the internal database ID

setCode

public void setCode(int internalID,
                    String code)
             throws SQLException
Request an Update into the database for a new Code

Parameters:
internalID - the internal database ID of the object
code - the Code that will be set
Throws:
SQLException

getTransformation

public Transformation getTransformation(CoordinateSystem sourceCRS,
                                        CoordinateSystem targetCRS)
                                 throws CRSConfigurationException
Description copied from interface: CRSProvider
This method is should retrieve a transformation (chain) which transforms coordinates from the given source into the given target crs. If no such transformation could be found or the implementation does not support inverse lookup of transformations null should be returned.

Specified by:
getTransformation in interface CRSProvider
Parameters:
sourceCRS -
targetCRS -
Returns:
null
Throws:
CRSConfigurationException

getCRSByCode

public CoordinateSystem getCRSByCode(CRSCodeType code)
                              throws CRSConfigurationException
Retrieves the CRS via its code

Specified by:
getCRSByCode in interface CRSProvider
Parameters:
code -
Returns:
the CoordinateSystem identified
Throws:
CRSConfigurationException

canExport

public boolean canExport()
Specified by:
canExport in interface CRSProvider
Returns:
whether there is an exported or not

getAvailableCRSCodes

public List<CRSCodeType> getAvailableCRSCodes()
Description copied from interface: CRSProvider
This method should be called if one is only interested in the available identifiers and not in the coordinatesystems themselves.

Specified by:
getAvailableCRSCodes in interface CRSProvider
Returns:
a list of CRSCodeTypes from all the available CRSs

getAvailableCRSs

public List<CoordinateSystem> getAvailableCRSs()
Description copied from interface: CRSProvider
This method should be called to see if the provider is able to create all defined crs's, thus verifying the correctness of the configuration.

Specified by:
getAvailableCRSs in interface CRSProvider
Returns:
a list of CoordinateSystems of all the available CRSs.

export

public void export(StringBuilder sb,
                   List<CoordinateSystem> crsToExport)
Description copied from interface: CRSProvider
Exports the crs to the implemented format. Try calling CRSProvider.canExport() before executing this method.

Specified by:
export in interface CRSProvider
Parameters:
sb -
crsToExport -
See Also:
CRSProvider.canExport()

remove

public void remove(List<CoordinateSystem> crsList)
            throws SQLException
Parameters:
crsList - a list of CoordinateSystems to be removed
Throws:
SQLException

changeAxisCode

public void changeAxisCode(String axisName,
                           String axisOrientation,
                           Unit uom,
                           CRSCodeType code)
                    throws SQLException
Method used by the synchronization-with-EPSG-database class to update the Axis with the EPSG code that it was lacking.

Parameters:
axisName -
axisOrientation -
uom -
code - the EPSG code that will be assigned to the Axis
Throws:
SQLException

export

public void export(List<CoordinateSystem> crsList)
            throws SQLException,
                   CRSException
Export a list of CoordianteSystems to the database

Parameters:
crsList -
Throws:
SQLException
CRSException

getConnection

public Connection getConnection()
Returns:
database connection

getRemover

public CRSRemover getRemover()
Returns:
the remover object that was initialized once the db crs provider was instantiated.

getIdentifiable

public CRSIdentifiable getIdentifiable(CRSCodeType id)
                                throws CRSConfigurationException
Description copied from interface: CRSProvider
This method is more general than the CRSProvider.getCRSByCode(CRSCodeType), because it represents a possibility to return an arbitrary CRSIdentifiable Object from the providers backend.

Specified by:
getIdentifiable in interface CRSProvider
Parameters:
id - the CRSCodeType of the wanted identifiable
Returns:
the CRSIdentifiable object
Throws:
CRSConfigurationException - if the implementation was confronted by an exception and could not deliver the requested Object. This exception should not be thrown if the given id wasn't found, in this case null should be returned.

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>