1
2
3
4
5
6
7
8
9
10
11 package psiprobe.controllers.datasources;
12
13 import jakarta.servlet.http.HttpServletRequest;
14 import jakarta.servlet.http.HttpServletResponse;
15
16 import java.util.List;
17
18 import org.springframework.beans.factory.annotation.Value;
19 import org.springframework.stereotype.Controller;
20 import org.springframework.web.bind.annotation.RequestMapping;
21 import org.springframework.web.servlet.ModelAndView;
22
23 import psiprobe.controllers.AbstractTomcatContainerController;
24 import psiprobe.model.ApplicationResource;
25
26
27
28
29 @Controller
30 public class ListAllJdbcResourcesController extends AbstractTomcatContainerController {
31
32 @RequestMapping(path = "/datasources.htm")
33 @Override
34 public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
35 throws Exception {
36 return super.handleRequest(request, response);
37 }
38
39 @Override
40 protected ModelAndView handleRequestInternal(HttpServletRequest request,
41 HttpServletResponse httpServletResponse) throws Exception {
42
43 boolean supportsGlobal = getContainerWrapper().getResourceResolver().supportsGlobalResources();
44 boolean supportsPrivate =
45 getContainerWrapper().getResourceResolver().supportsPrivateResources();
46 boolean supportsDataSourceLookup =
47 getContainerWrapper().getResourceResolver().supportsDataSourceLookup();
48 List<ApplicationResource> privateResources = getContainerWrapper().getPrivateDataSources();
49 List<ApplicationResource> globalResources = getContainerWrapper().getGlobalDataSources();
50 return new ModelAndView(getViewName()).addObject("supportsGlobal", supportsGlobal)
51 .addObject("supportsPrivate", supportsPrivate)
52 .addObject("supportsDSLookup", supportsDataSourceLookup)
53 .addObject("privateResources", privateResources)
54 .addObject("globalResources", globalResources);
55 }
56
57 @Value("datasources")
58 @Override
59 public void setViewName(String viewName) {
60 super.setViewName(viewName);
61 }
62
63 }