Project

General

Profile

« Previous | Next » 

Revision 5770

Added by berkley over 13 years ago

implemented health api

View differences:

HealthService.java
24 24
package edu.ucsb.nceas.metacat.dataone;
25 25

  
26 26
import java.io.IOException;
27
import java.util.Date;
27 28

  
28 29
import javax.servlet.http.HttpServletRequest;
29 30
import javax.servlet.http.HttpServletResponse;
30 31

  
31 32
import org.dataone.service.mn.MemberNodeHealth;
33
import org.dataone.service.types.Identifier;
34
import org.dataone.service.types.ObjectFormat;
35
import org.dataone.service.types.ObjectInfo;
32 36
import org.omg.CORBA.portable.OutputStream;
33 37

  
34 38
/**
35 39
 * @author berkley
36
 *
40
 * Class to implement the HealthService API for DataONE
37 41
 */
38 42
public class HealthService implements MemberNodeHealth
39 43
{    
40 44
    HttpServletRequest request;
41 45
    HttpServletResponse response;
42 46
    
47
    /**
48
     * Constructor
49
     * @param request
50
     * @param response
51
     */
43 52
    public HealthService(HttpServletRequest request, HttpServletResponse response)
44 53
    {
45 54
        this.request = request;
46 55
        this.response = response;
47 56
    }
48 57
    
58
    /**
59
     * Implements /monitory/ping from 
60
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
61
     */
49 62
    public void ping()
50 63
    {
51 64
        response.setStatus(200);
......
61 74
        }
62 75
    }
63 76
    
64
    public void getObjectStatistics()
77
    /**
78
     * implements /monitor/object from 
79
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
80
     */
81
    public void getObjectStatistics(boolean reportDaily, 
82
            Identifier guid, String url, ObjectFormat format, Date time)
65 83
    {
84
        response.setStatus(500);
85
        try
86
        {
87
            response.getOutputStream().write("getObjectStatistics Not Implemented".getBytes());
88
            response.getOutputStream().flush();
89
        }
90
        catch (IOException e)
91
        {
92
            System.out.println("Error in getObjectStatistics: " + e.getMessage());
93
            e.printStackTrace();
94
        }
66 95
        
67 96
    }
68 97
    
69
    public void getOperationStatistics()
98
    /**
99
     * implements /monitor/event from
100
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
101
     */
102
    public void getOperationStatistics(boolean reportDaily, Identifier pid, 
103
            ObjectFormat format, Date createDate, Date eventTime, String ipAddress, String event)
70 104
    {
71
        
105
        response.setStatus(500);
106
        try
107
        {
108
            response.getOutputStream().write("getOperationStatistics Not Implemented".getBytes());
109
            response.getOutputStream().flush();
110
        }
111
        catch (IOException e)
112
        {
113
            System.out.println("Error in getOperationStatistics: " + e.getMessage());
114
            e.printStackTrace();
115
        }
72 116
    }
73 117
    
118
    /**
119
     * Implements /monitor/status from
120
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
121
     * This method is mostly unimplemented.  Right now it just does what ping does.
122
     * It should be updated in the future to return status information such as 
123
     * pending outages, software updates, etc.  See Use Case 10 for more 
124
     * info.
125
     */
74 126
    public void getStatus()
75 127
    {
76
        
128
        ping();
77 129
    }
78 130
}

Also available in: Unified diff