9 |
9 |
|
10 |
10 |
import javax.annotation.Resource;
|
11 |
11 |
|
|
12 |
import org.apache.commons.lang3.StringUtils;
|
|
13 |
|
12 |
14 |
import org.apache.commons.logging.Log;
|
13 |
15 |
import org.apache.commons.logging.LogFactory;
|
|
16 |
|
14 |
17 |
import org.dom4j.Document;
|
15 |
18 |
import org.dom4j.DocumentException;
|
16 |
19 |
import org.dom4j.io.SAXReader;
|
17 |
20 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
21 |
import org.springframework.beans.factory.annotation.Value;
|
18 |
22 |
import org.springframework.stereotype.Controller;
|
19 |
23 |
import org.springframework.ui.Model;
|
20 |
24 |
import org.springframework.web.bind.annotation.RequestMapping;
|
... | ... | |
50 |
54 |
@Resource
|
51 |
55 |
private MDStoreFeeder feeder;
|
52 |
56 |
|
|
57 |
@Value("${dhp.openaire.mdstore.inspector.url}")
|
|
58 |
private String hadoopMdstoreInspectorUrl;
|
|
59 |
|
53 |
60 |
@RequestMapping(value = "/inspector/mdstores.do")
|
54 |
61 |
public void mdstores(final Model model) throws MDStoreServiceException {
|
55 |
62 |
model.addAttribute("mdstores", dao.listMDStores());
|
56 |
63 |
}
|
57 |
64 |
|
58 |
65 |
@RequestMapping(value = "/inspector/mdstore.do", method = RequestMethod.GET)
|
59 |
|
public void mdstore(final Model model,
|
|
66 |
public String mdstore(final Model model,
|
60 |
67 |
@RequestParam("id") final String id,
|
61 |
68 |
@RequestParam(value = "start", required = false) final Integer startParam,
|
62 |
69 |
@RequestParam(value = "regex", required = false) final String regex) throws MDStoreServiceException {
|
|
70 |
|
|
71 |
if (StringUtils.isNotBlank(hadoopMdstoreInspectorUrl) && id.startsWith("md-")) {
|
|
72 |
final String url = String.format(hadoopMdstoreInspectorUrl, id);
|
|
73 |
log.info("Redirect to " + url);
|
|
74 |
return "redirect:" + url;
|
|
75 |
}
|
|
76 |
|
63 |
77 |
int pageSize = 10;
|
64 |
78 |
int start = 0;
|
65 |
79 |
|
... | ... | |
99 |
113 |
model.addAttribute("prevPage", Math.max(0, start - pageSize));
|
100 |
114 |
model.addAttribute("size", rs.getSize());
|
101 |
115 |
model.addAttribute("page", page);
|
|
116 |
|
|
117 |
return "inspector/mdstore";
|
102 |
118 |
}
|
103 |
119 |
|
104 |
120 |
@RequestMapping(value = "/inspector/mdstore.do", method = RequestMethod.POST)
|
redirect to openaire md inspector with hadoop