package org.datacite.mds.web.api.controller;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.datacite.mds.web.api.ApiController;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class StatusController implements ApiController {
    
    @PersistenceContext
    EntityManager em;
    
    @RequestMapping(value = "/status")
    public ResponseEntity<String> status() {
        checkDatabaseConnection();
        return new ResponseEntity<String>("OK", null, HttpStatus.OK);
    }
    
    private void checkDatabaseConnection() {
        em.createNativeQuery("SELECT 1").getSingleResult();
    }

}

@@ -153,29 +153,188 @@
 mds.
-web.api.ApiController
+service.HandleException;%0Aimport org.datacite.mds.service.HandleService;%0Aimport org.datacite.mds.web.api.ApiController;%0Aimport org.springframework.beans.factory.annotation.Autowired
 ;%0Aim
@@ -658,24 +658,77 @@
 er em;%0A    %0A
+    @Autowired%0A    HandleService handleService;%0A    %0A
     @Request
@@ -796,16 +796,39 @@
 status()
+ throws HandleException
  %7B%0A     
@@ -853,24 +853,54 @@
 nnection();%0A
+        handleService.ping();%0A
         retu

check handle server on /status (closes #206)