KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quickserver > util > xmlreader > KeyStoreInfo


1 /*
2  * This file is part of the QuickServer library
3  * Copyright (C) 2003-2005 QuickServer.org
4  *
5  * Use, modification, copying and distribution of this software is subject to
6  * the terms and conditions of the GNU Lesser General Public License.
7  * You should have received a copy of the GNU LGP License along with this
8  * library; if not, you can download a copy from <http://www.quickserver.org/>.
9  *
10  * For questions, suggestions, bug-reports, enhancement-requests etc.
11  * visit http://www.quickserver.org
12  *
13  */

14
15 package org.quickserver.util.xmlreader;
16
17 /**
18  * This class encapsulate Key Store.
19  * The example xml is <pre>
20     ....
21     &lt;key-store-info&gt;
22         &lt;store-file&gt;NONE&lt;/store-file&gt;
23         &lt;store-password&gt;&lt;/store-password&gt;
24         &lt;key-password&gt;&lt;/key-password&gt;
25     &lt;/key-store-info&gt;
26     ....
27  </pre>
28  * @see TrustStoreInfo
29  * @see SecureStore
30  * @see Secure
31  * @author Akshathkumar Shetty
32  * @since 1.4
33  */

34 public class KeyStoreInfo implements java.io.Serializable JavaDoc {
35     private String JavaDoc storeFile = "NONE";
36     private String JavaDoc storePassword = null;
37     private String JavaDoc keyPassword = null;
38
39     /**
40      * Sets the store file path. This can be either absolute or
41      * relative(to config file) path to the store file.
42      * XML Tag: &lt;store-file&gt;NONE&lt;/store-file&gt;
43      * @param storeFile store file.
44      * @see #getStoreFile
45      */

46     public void setStoreFile(String JavaDoc storeFile) {
47         if(storeFile!=null && storeFile.trim().length()!=0)
48             this.storeFile = storeFile;
49     }
50     /**
51      * Returns the store file path. This can be either absolute or
52      * relative(to config file) path to the store file.
53      * @see #setStoreFile
54      */

55     public String JavaDoc getStoreFile() {
56         return storeFile;
57     }
58
59     /**
60      * Sets the store password.
61      * XML Tag: &lt;store-password&gt;&lt;/store-password&gt;
62      * @param storePassword store password
63      * @see #getStorePassword
64      */

65     public void setStorePassword(String JavaDoc storePassword) {
66         if(storePassword!=null)
67             this.storePassword = storePassword;
68     }
69     /**
70      * Returns store password.
71      * @see #setStorePassword
72      */

73     public String JavaDoc getStorePassword() {
74         return storePassword;
75     }
76
77     /**
78      * Sets the key password.
79      * XML Tag: &lt;key-password&gt;&lt;/key-password&gt;
80      * @param keyPassword key password
81      * @see #getKeyPassword
82      */

83     public void setKeyPassword(String JavaDoc keyPassword) {
84         if(keyPassword!=null)
85             this.keyPassword = keyPassword;
86     }
87     /**
88      * Returns key password.
89      * @see #setKeyPassword
90      */

91     public String JavaDoc getKeyPassword() {
92         return keyPassword;
93     }
94     
95     /**
96      * Returns XML config of this class.
97      */

98     public String JavaDoc toXML(String JavaDoc pad) {
99         if(pad==null) pad="";
100         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
101         sb.append(pad+"<key-store-info>\n");
102         sb.append(pad+"\t<store-file>"+getStoreFile()+"</store-file>\n");
103         if(getStorePassword()!=null)
104             sb.append(pad+"\t<store-password>"+getStorePassword()+"</store-password>\n");
105         else
106             sb.append(pad+"\t</store-password>\n");
107         if(getKeyPassword()!=null)
108             sb.append(pad+"\t<key-password>"+getKeyPassword()+"</key-password>\n");
109         else
110             sb.append(pad+"\t</key-password>\n");
111         sb.append(pad+"</key-store-info>\n");
112         return sb.toString();
113     }
114 }
115
Popular Tags