3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.remote
.controller
.ext
;
12 import java
.io
.IOException
;
13 import java
.util
.List
;
15 import javax
.servlet
.http
.HttpServletRequest
;
16 import javax
.servlet
.http
.HttpServletResponse
;
18 import org
.apache
.commons
.lang
.ObjectUtils
;
19 import org
.apache
.log4j
.Logger
;
20 import org
.springframework
.stereotype
.Controller
;
21 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
22 import org
.springframework
.web
.bind
.annotation
.RequestMethod
;
23 import org
.springframework
.web
.bind
.annotation
.RequestParam
;
24 import org
.springframework
.web
.servlet
.ModelAndView
;
26 import eu
.etaxonomy
.cdm
.database
.UpdatableRoutingDataSource
;
27 import eu
.etaxonomy
.cdm
.ext
.dc
.DublinCoreSchemaAdapter
;
28 import eu
.etaxonomy
.cdm
.ext
.sru
.SruServiceWrapper
;
29 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
32 * The ExternalGeoController class is a Spring MVC Controller.
34 * The syntax of the mapped service URIs contains the the {datasource-name} path element.
35 * The available {datasource-name}s are defined in a configuration file which
36 * is loaded by the {@link UpdatableRoutingDataSource}. If the
37 * UpdatableRoutingDataSource is not being used in the actual application
38 * context any arbitrary {datasource-name} may be used.
40 * @author a.kohlbecker
45 @RequestMapping(value
= { "/ext/bhl-e/" })
46 public class ExternalBhleController
{
48 public static final Logger logger
= Logger
.getLogger(ExternalBhleController
.class);
50 public static String baseUrl
= "http://gso.gbv.de/sru/DB=2.1/";
52 SruServiceWrapper sruServiceWrapper
;
57 public ExternalBhleController() {
58 sruServiceWrapper
= new SruServiceWrapper();
59 sruServiceWrapper
.setBaseUrl(baseUrl
);
60 sruServiceWrapper
.addSchemaAdapter(new DublinCoreSchemaAdapter());
64 @RequestMapping(value
= { "grib/sru" }, method
= RequestMethod
.GET
)
65 public ModelAndView
doSearchRetrieve(
66 @RequestParam(value
= "query", required
= true) String cqlQuery
,
67 HttpServletRequest request
,
68 HttpServletResponse response
)
71 logger
.info("doSearchRetrieve( " + "query=\"" + ObjectUtils
.toString(cqlQuery
) + "\")");
72 ModelAndView mv
= new ModelAndView();
74 List
<Reference
> referenceList
= sruServiceWrapper
.doSearchRetrieve(cqlQuery
, "dc");
76 mv
.addObject(referenceList
);