KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > protocol > ResponseStatus


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13  
14 /**
15  * $Header: /cvsroot/ejbca/ejbca/src/java/org/ejbca/core/protocol/ResponseStatus.java,v 1.1 2006/01/17 20:28:06 anatom Exp $
16  * $Revision: 1.1 $
17  * $Date: 2006/01/17 20:28:06 $
18  *
19  */

20 package org.ejbca.core.protocol;
21
22 import java.io.Serializable JavaDoc;
23
24 /**
25  * Encapsulates the possible values for the status of a SCEP response.
26  *
27  * @author Jon Barber (jon.barber@acm.org)
28  */

29
30 public class ResponseStatus implements Serializable JavaDoc {
31
32     /**
33      * Request granted
34      */

35     public static final ResponseStatus SUCCESS = new ResponseStatus(0);
36
37     /**
38      * Request rejected
39      */

40     public static final ResponseStatus FAILURE = new ResponseStatus(2);
41
42     /**
43      * Request pending for approval
44      */

45     public static final ResponseStatus PENDING = new ResponseStatus(3);
46
47     /**
48      * The value actually encoded into the response message as a pkiStatus attribute
49      */

50     private final int value;
51
52     private ResponseStatus(int value) {
53         this.value = value;
54     }
55
56     /**
57      * Gets the value embedded in the response message as a pkiStatus attribute
58      * @return the value to use
59      */

60     public String JavaDoc getValue() {
61         return Integer.toString(value);
62     }
63
64
65     public boolean equals(Object JavaDoc o) {
66         if (this == o) return true;
67         if (!(o instanceof ResponseStatus)) return false;
68
69         final ResponseStatus scepResponseStatus = (ResponseStatus) o;
70
71         if (value != scepResponseStatus.value) return false;
72
73         return true;
74     }
75
76     public int hashCode() {
77         return value;
78     }
79 }
80
Popular Tags