com.gisgraphy.domain.repository
Class RepositoryStrategy

java.lang.Object
  extended by com.gisgraphy.domain.repository.RepositoryStrategy
All Implemented Interfaces:
IRepositoryStrategy

@Component
public class RepositoryStrategy
extends java.lang.Object
implements IRepositoryStrategy

A class based on the stategy pattern

Author:
David Masclet
See Also:
Strategy pattern

Field Summary
static java.util.Map<java.lang.Class<? extends GisFeature>,IGisDao<? extends GisFeature>> daoMap
          A Map with GisFeature call as keys and Dao as Values.
protected  IGisDao<? extends GisFeature>[] daos
           
protected static org.slf4j.Logger logger
          The logger
 
Constructor Summary
RepositoryStrategy()
           
 
Method Summary
 java.util.Collection<IGisDao<? extends GisFeature>> getAvailablesDaos()
           
 IGisDao<? extends GisFeature> getDao(java.lang.Class<? extends GisFeature> placeType)
           
 void initMap()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

daos

protected IGisDao<? extends GisFeature>[] daos

logger

protected static final org.slf4j.Logger logger
The logger


daoMap

public static final java.util.Map<java.lang.Class<? extends GisFeature>,IGisDao<? extends GisFeature>> daoMap
A Map with GisFeature call as keys and Dao as Values. A (Gis)dao is associated to a Class

Constructor Detail

RepositoryStrategy

public RepositoryStrategy()
Method Detail

initMap

@PostConstruct
public void initMap()
             throws java.lang.Exception
Throws:
java.lang.Exception

getDao

public IGisDao<? extends GisFeature> getDao(java.lang.Class<? extends GisFeature> placeType)
Specified by:
getDao in interface IRepositoryStrategy
Parameters:
placeType - the placetype we'd like to retrieve the dao. if the place type is null the gisFeatureDao will be return
Returns:
the dao corresponding to the specified class

getAvailablesDaos

public java.util.Collection<IGisDao<? extends GisFeature>> getAvailablesDaos()
Specified by:
getAvailablesDaos in interface IRepositoryStrategy
Returns:
all the availables daos. never return null but an empty Arraylist if there is no dao


Copyright © 2010. All Rights Reserved.