@SuppressWarnings({ "unchecked", "rawtypes" })
public StoreBuilder source(String source){
if( source.endsWith(".shp")){
when(store.getConnectionParameters()).thenReturn(
(Map<String,Serializable>) (Map) new KVP("url", source) );
}
else if( source.endsWith(".png")||source.endsWith(".tif")||source.endsWith(".tiff")){
when(store.getConnectionParameters()).thenReturn(
(Map<String,Serializable>) (Map) new KVP("raster", source) );
}
else if( source.startsWith("postgis")){
String host = source.substring(8);
when(store.getConnectionParameters()).thenReturn(
(Map<String,Serializable>) (Map) new KVP("dbtype", "postgis","host",host,"port","5432") );
}
else if( source.contains("service=wms")){
when(store.getConnectionParameters()).thenReturn(
(Map<String,Serializable>) (Map) new KVP("wms", source) );
}
else {
when(store.getConnectionParameters()).thenReturn(
(Map<String,Serializable>) (Map) new KVP("directory", source) );
}
return this;
}