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

org.deegree.crs.configuration
Class CRSConfiguration

java.lang.Object
  extended by org.deegree.crs.configuration.CRSConfiguration

public class CRSConfiguration
extends Object

The CRSConfiguration creates, instantiates and supplies a configured CRS-Provider. Because only one crs-configuration is needed inside the JVM, this implementation uses a singleton pattern.

The configuration will try to read the file: crs_providers.properties. It uses the following strategy to load this file, first the root directory (e.g. '/' or WEB-INF/classes ) will be searched. If no file was found there, it will try to load from the package. The properties file must denote a property with name 'CRS_PROVIDER' followed by a '=' and a fully qualified name denoting the class (an instance of CRSProvider) which should be available in the classpath. This class must have an empty constructor.

The class is also a command line tool for transferring CRSs between providers. Please see the main method or call the class with -h. The last feature introduced was the possibility of removing CRSs from the database backend (by using the -remove command-line parameter).

Version:
$Revision: 22634 $, $Date: 2010-02-19 11:32:33 +0100 (Fr, 19 Feb 2010) $
Author:
Rutger Bezema, last edited by: $Author: rbezema $

Field Summary
static Map<String,CRSConfiguration> DEFINED_CONFIGURATIONS
           
 
Method Summary
static CRSConfiguration getCRSConfiguration()
          Creates or returns an instance of the CRSConfiguration by reading the DEFAULT property configured in the 'crs_providers.properties'.
static CRSConfiguration getCRSConfiguration(String providerName)
          Creates or returns an instance of the CRSConfiguration by trying to instantiate the given provider class.
 CRSProvider getProvider()
           
 TransformationFactory getTransformationFactory()
           
static String setDefaultFileProperty(String fileName)
          Overwrites the crs.configuration property with the given value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFINED_CONFIGURATIONS

public static final Map<String,CRSConfiguration> DEFINED_CONFIGURATIONS
Method Detail

getCRSConfiguration

public static CRSConfiguration getCRSConfiguration(String providerName)
Creates or returns an instance of the CRSConfiguration by trying to instantiate the given provider class. If the name is null or "" the Provider configured in the 'crs_providers.properties' will be returned. If the instantiation of this class fails a DeegreeCRSProvider will be returned.

Parameters:
providerName - the canonical name of the class, e.g. org.deegree.crs.MyProvider
Returns:
an instance of a CRS-Configuration with the configured CRSProvider.
Throws:
CRSConfigurationException - if --anything-- went wrong while instantiating the CRSProvider.

getCRSConfiguration

public static CRSConfiguration getCRSConfiguration()
                                            throws CRSConfigurationException
Creates or returns an instance of the CRSConfiguration by reading the DEFAULT property configured in the 'crs_providers.properties'. If no key is given (or no string could be loaded), the DeegreeCRSProvider will be used.

Returns:
an instance of a CRS-Configuration with the configured CRSProvider.
Throws:
CRSConfigurationException - if --anything-- went wrong while instantiating the CRSProvider.

setDefaultFileProperty

public static String setDefaultFileProperty(String fileName)
Overwrites the crs.configuration property with the given value.

Parameters:
fileName - to set the crs.configuration property to.
Returns:
the old crs.configuration propert (if any)
Throws:
CRSConfigurationException - if --anything-- went wrong while instantiating the CRSProvider.

getProvider

public final CRSProvider getProvider()
Returns:
the crs provider.

getTransformationFactory

public final TransformationFactory getTransformationFactory()
Returns:
a transformation factory instantiated with the provider;

toString

public String toString()
Overrides:
toString in class Object
Returns:
a text that specifies whether a crs is provided or not (and the canonical name of the provider, if that is the case)

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

]]>