1 package ch.busyboxes.agoo.controller;
2
3 import org.apache.log4j.Logger;
4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.stereotype.Controller;
6 import org.springframework.ui.ModelMap;
7 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestMethod;
9
10 import ch.busyboxes.agoo.service.WatchedFileService;
11
12
13
14
15
16
17 @Controller
18 @RequestMapping("/agoo.html")
19 public class IndexController {
20
21
22 private Logger logger = Logger.getLogger(IndexController.class);
23
24
25 private WatchedFileService watchedFileService;
26
27
28
29
30 public IndexController() {
31 logger.info("Index controller initiated");
32 }
33
34
35
36
37
38
39 @RequestMapping(method = RequestMethod.GET)
40 public void indexPage(ModelMap model) {
41
42
43 long numberOfFilesWatched = watchedFileService.getNumberOfFilesWatched();
44
45
46 model.addAttribute("numberFiles", numberOfFilesWatched);
47 }
48
49
50
51
52
53
54 @Autowired
55 public void setWatchedFileService(WatchedFileService watchedFileService) {
56 this.watchedFileService = watchedFileService;
57 }
58
59 }