KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > hardtoken > HardTokenIssuer


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  * HardTokenIssuer.java
16  *
17  * Created on den 19 januari 2003, 12:53
18  */

19 package org.ejbca.core.model.hardtoken;
20
21 import java.io.Serializable JavaDoc;
22 import java.util.ArrayList JavaDoc;
23 import java.util.HashMap JavaDoc;
24 import java.util.Iterator JavaDoc;
25
26 import org.ejbca.core.model.UpgradeableDataHashMap;
27
28 /**
29  * HardTokenIssuer V3 is a class representing the data saved for each HardTokenIssuer.
30  * it isn't back compatible with the old version.
31  *
32  * @author TomSelleck
33  * @version $Id: HardTokenIssuer.java,v 1.1 2006/01/17 20:31:52 anatom Exp $
34  */

35 public class HardTokenIssuer extends UpgradeableDataHashMap implements Serializable JavaDoc, Cloneable JavaDoc {
36
37     // Default Values
38
public static final float LATEST_VERSION = 1;
39
40     // Protexted Constants, must be overloaded by all deriving classes.
41
protected static final String JavaDoc AVAILABLEHARDTOKENSPROFILES = "availablehardtokensprofiles";
42     protected static final String JavaDoc DESCRIPTION = "description";
43     // Public Constructors.
44

45     public HardTokenIssuer(){
46       data.put(AVAILABLEHARDTOKENSPROFILES,new ArrayList JavaDoc());
47       data.put(DESCRIPTION,"");
48     }
49     
50     // Public Methods
51

52     // Availablehardtokens defines which hard tokens the issuer is able to issue.
53
public ArrayList JavaDoc getAvailableHardTokenProfiles(){
54       return (ArrayList JavaDoc) data.get(AVAILABLEHARDTOKENSPROFILES);
55     }
56     
57     public void setAvailableHardTokenProfiles(ArrayList JavaDoc availablehardtokens){
58       data.put(AVAILABLEHARDTOKENSPROFILES,availablehardtokens);
59     }
60     
61     public String JavaDoc getDescription(){
62       return (String JavaDoc) data.get(DESCRIPTION);
63     }
64
65     public void setDescription(String JavaDoc description){
66       data.put(DESCRIPTION, description);
67     }
68     
69     public void setField(String JavaDoc field, Object JavaDoc value){
70        data.put(field,value);
71     }
72     
73     /** Implemtation of UpgradableDataHashMap function getLatestVersion */
74     public float getLatestVersion(){
75        return LATEST_VERSION;
76     }
77
78     /** Implemtation of UpgradableDataHashMap function upgrade. */
79
80     public void upgrade(){
81     }
82     
83     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
84       HardTokenIssuer clone = new HardTokenIssuer();
85       HashMap JavaDoc clonedata = (HashMap JavaDoc) clone.saveData();
86       
87       Iterator JavaDoc i = (data.keySet()).iterator();
88       while(i.hasNext()){
89         Object JavaDoc key = i.next();
90         clonedata.put(key,data.get(key));
91       }
92       
93       clone.loadData(clonedata);
94       return clone;
95     }
96
97 }
98
Popular Tags