PageRenderTime 19ms CodeModel.GetById 9ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/layers-service/src/main/java/org/ala/layers/web/LayerPidService.java

http://alageospatialportal.googlecode.com/
Java | 93 lines | 21 code | 9 blank | 63 comment | 0 complexity | aa6cc5885502df77575afd8c60766c53 MD5 | raw file
 1/*
 2 * To change this template, choose Tools | Templates
 3 * and open the template in the editor.
 4 */
 5
 6package org.ala.layers.web;
 7
 8import java.util.List;
 9import javax.annotation.Resource;
10import javax.servlet.http.HttpServletRequest;
11import org.ala.layers.dao.LayerPidDAO;
12import org.ala.layers.dto.LayerPid;
13import org.apache.log4j.Logger;
14import org.springframework.stereotype.Controller;
15import org.springframework.web.bind.annotation.RequestMapping;
16import org.springframework.web.bind.annotation.RequestMethod;
17import org.springframework.web.bind.annotation.ResponseBody;
18
19/**
20 *
21 * @author ajay
22 */
23@Controller
24public class LayerPidService {
25
26    /**
27     * Log4j instance
28     */
29    protected Logger logger = Logger.getLogger(this.getClass());
30
31    @Resource(name="layerPidDao")
32    private LayerPidDAO layerPidDao;
33
34    @RequestMapping(value = "/layerpids", method = RequestMethod.GET)
35    public @ResponseBody List<LayerPid> listLayerPids(HttpServletRequest req) {
36        return layerPidDao.getLayers();
37
38    }
39
40//    @RequestMapping(value = "/layerpids/populate", method = RequestMethod.GET)
41//    public void populateLayerPids(HttpServletRequest req, HttpServletResponse res) {
42//
43//        System.out.println("started populate");
44//
45//        //String query = "SELECT * FROM layerpids;";
46//
47//        //ResultSet r = DBConnection.query(query);
48//
49//        //return Utils.resultSetToJSON(r);
50//
51//        PGBridge.getLayer();
52//
53//        System.out.println("table population completed");
54//    }
55//
56//    @RequestMapping(value = "/layerpids/generate", method = RequestMethod.GET)
57//    public void generateLayerPids(HttpServletRequest req, HttpServletResponse res) {
58//
59//        System.out.println("started generate");
60//
61//        //String query = "SELECT * FROM layerpids;";
62//
63//        //ResultSet r = DBConnection.query(query);
64//
65//        //return Utils.resultSetToJSON(r);
66//
67//        // https://test.ands.org.au:8443/pids/
68//        // 2c6ed180e966774eee8409f7152b0cc885d07f71
69//
70//        try {
71//            AndsPidIdentity andsid = new AndsPidIdentity();
72//            andsid.setAppId("2c6ed180e966774eee8409f7152b0cc885d07f71");
73//            andsid.setAuthDomain("csiro.au");
74//            andsid.setIdentifier("ran126");
75//
76//            AndsPidClient ands = new AndsPidClient();
77//            ands.setPidServiceHost("test.ands.org.au");
78//            ands.setPidServicePath("pids");
79//            ands.setPidServicePort(8443);
80//            ands.setRequestorIdentity(andsid);
81//            AndsPidResponse mintHandleFormattedResponse = ands.mintHandleFormattedResponse(AndsPidClient.HandleType.DESC, "test");
82//
83//            System.out.println("handle creation status: " + mintHandleFormattedResponse.isSuccess());
84//
85//        } catch (Exception e) {
86//        }
87//
88//
89//
90//        System.out.println("PID generation completed");
91//    }
92
93}