KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > hardtoken > types > TurkishEIDHardToken


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 package org.ejbca.core.model.hardtoken.types;
15
16 import org.ejbca.core.model.SecConst;
17
18
19
20 /**
21  * TurkishEIDHardToken is a class defining data stored in database for a Turkish EID token.
22  *
23  * @version $Id: TurkishEIDHardToken.java,v 1.2 2006/11/11 12:46:04 herrvendil Exp $
24  */

25 public class TurkishEIDHardToken extends HardToken {
26     // Public Constants
27
public static final int THIS_TOKENTYPE = SecConst.TOKEN_TURKISHEID;
28     
29     public static final String JavaDoc INITIALPIN = "INITIALPIN";
30     public static final String JavaDoc PUK = "PUK";
31        
32     
33     public static final String JavaDoc[] FIELDS = {
34         INITIALPIN, PUK, EMPTYROW_FIELD
35     };
36     public static final int[] DATATYPES = { STRING, STRING, EMPTYROW};
37     public static final String JavaDoc[] FIELDTEXTS = {
38         INITIALPIN, PUK, EMPTYROW_FIELD
39     };
40
41     // Public Methods
42
/** Constructor to use. */
43     public TurkishEIDHardToken(String JavaDoc initialpin,
44                                String JavaDoc puk,
45                                int hardtokenprofileid) {
46         setInitialPIN(initialpin);
47         setPUK(puk);
48
49         setTokenProfileId(hardtokenprofileid);
50         
51         data.put(TOKENTYPE, new Integer JavaDoc(THIS_TOKENTYPE));
52     }
53     
54     /** Constructor only to be used internally. */
55     public TurkishEIDHardToken() {
56         data.put(TOKENTYPE, new Integer JavaDoc(THIS_TOKENTYPE));
57     }
58
59
60     public int getNumberOfFields() {
61         return TurkishEIDHardToken.FIELDS.length;
62     }
63
64     public String JavaDoc getFieldText(int index) {
65         return TurkishEIDHardToken.FIELDTEXTS[index];
66     }
67
68     public String JavaDoc getFieldPointer(int index) {
69         return TurkishEIDHardToken.FIELDS[index];
70     }
71
72
73     public int getFieldDataType(int index) {
74         return TurkishEIDHardToken.DATATYPES[index];
75     }
76     
77     // Public Methods.
78
public String JavaDoc getInitialPIN() {
79         return (String JavaDoc) data.get(INITIALPIN);
80     }
81
82     public void setInitialPIN(String JavaDoc initialpin) {
83         data.put(INITIALPIN, initialpin);
84     }
85     
86
87     public String JavaDoc getPUK() {
88         return (String JavaDoc) data.get(PUK);
89     }
90
91     public void setPUK(String JavaDoc puk) {
92         data.put(PUK, puk);
93     }
94     
95
96  
97 }
98
Popular Tags