KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > core > dm > ddf > DMAccount


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package sync4j.framework.core.dm.ddf;
20
21 import sync4j.framework.tools.Base64;
22
23 /**
24  * Corresponds to the single dm account node in the management tree
25  *
26  * @author Stefano Nichele @ Funambol
27  *
28  * @version $Id: DMAccount.java,v 1.1 2005/05/16 17:32:55 nichele Exp $
29  */

30 public class DMAccount implements java.io.Serializable JavaDoc {
31
32     // --------------------------------------------------------------- Constants
33

34    public static final String JavaDoc DMACC_ADDR = "/Addr";
35    public static final String JavaDoc DMACC_ADDR_TYPE = "/AddrType" ;
36    public static final String JavaDoc DMACC_PORT_NBR = "/PortNbr" ;
37    public static final String JavaDoc DMACC_CON_REF = "/ConRef";
38    public static final String JavaDoc DMACC_SERVER_ID = "/ServerId";
39    public static final String JavaDoc DMACC_SERVER_PASSWORD = "/ServerPW";
40    public static final String JavaDoc DMACC_SERVER_NONCE = "/ServerNonce";
41    public static final String JavaDoc DMACC_USERNAME = "/UserName";
42    public static final String JavaDoc DMACC_CLIENT_PASSWORD = "/ClientPW";
43    public static final String JavaDoc DMACC_CLIENT_NONCE = "/ClientNonce";
44    public static final String JavaDoc DMACC_AUTH_PREF = "/AuthPref";
45    public static final String JavaDoc DMACC_NAME = "/Name";
46
47
48    // ------------------------------------------------------------ Private data
49
private String JavaDoc address;
50    private int addressType;
51    private int portNumber;
52    private String JavaDoc conRef;
53    private String JavaDoc serverId;
54    private String JavaDoc serverPassword;
55    private byte[] serverNonce;
56    private String JavaDoc userName;
57    private String JavaDoc clientPassword;
58    private byte[] clientNonce;
59    private String JavaDoc authPref;
60    private String JavaDoc name;
61
62
63
64    // ------------------------------------------------------------ Constructors
65
/** For serialization purposes */
66    public DMAccount() {}
67
68     /**
69      * Creates a new dm account object with the given parameters
70      *
71      * @param address the server address
72      * @param addressType the type of the server address
73      * @param portNumber the port number to use
74      * @param conRef the reference to connectivity information
75      * @param serverId the server identifier
76      * @param serverPassword the server password
77      * @param serverPassword the server password
78      * @param serverNonce the next nonce that the server will use
79      * @param clientPassword the password of the client
80      * @param clientNonce the next nonce that the client will use
81      * @param authPref the syncml authentication type
82      * @param name the user displayable name
83      */

84     public DMAccount(final String JavaDoc address,
85                      final int addressType,
86                      final int portNumber,
87                      final String JavaDoc conRef,
88                      final String JavaDoc serverId,
89                      final String JavaDoc serverPassword,
90                      final byte[] serverNonce,
91                      final String JavaDoc userName,
92                      final String JavaDoc clientPassword,
93                      final byte[] clientNonce,
94                      final String JavaDoc authPref,
95                      final String JavaDoc name) {
96         this.address = address;
97         this.addressType = addressType;
98         this.portNumber = portNumber;
99         this.conRef = conRef;
100         this.serverId = serverId;
101         this.serverPassword = serverPassword;
102         this.serverNonce = serverNonce;
103         this.userName = userName;
104         this.clientPassword = clientPassword;
105         this.clientNonce = clientNonce;
106         this.authPref = authPref;
107         this.name = name;
108     }
109
110
111     // ---------------------------------------------------------- Public methods
112

113     /**
114      * Gets the userName
115      *
116      * @return the userName
117      */

118     public String JavaDoc getUserName() {
119         return userName;
120     }
121
122     /**
123      * Sets the userName
124      *
125      * @param the userName
126      */

127     public void setUserName(String JavaDoc userName) {
128         this.userName = userName;
129     }
130
131     /**
132      * Gets the clientNonce
133      *
134      * @return the clientNonce
135      */

136     public byte[] getClientNonce() {
137         return clientNonce;
138     }
139
140     /**
141      * Sets the clientNonce
142      *
143      * @param the clientNonce
144      */

145     public void setClientNonce(byte[] clientNonce) {
146         this.clientNonce = clientNonce;
147     }
148
149     /**
150      * Sets the clientNonce
151      *
152      * @param the clientNonce
153      */

154     public void setClientNonce(String JavaDoc b64ClientNonce) {
155         this.clientNonce = Base64.decode(b64ClientNonce);
156     }
157
158     /**
159      * Gets the address
160      *
161      * @return the address
162      */

163     public String JavaDoc getAddress() {
164         return address;
165     }
166
167     /**
168      * Sets the address
169      *
170      * @param the address
171      */

172     public void setAddress(String JavaDoc address) {
173         this.address = address;
174     }
175
176     /**
177      * Gets the serverId
178      *
179      * @return the serverId
180      */

181     public String JavaDoc getServerId() {
182         return serverId;
183     }
184
185     /**
186      * Sets the serverId
187      *
188      * @param the serverId
189      */

190     public void setServerId(String JavaDoc serverId) {
191         this.serverId = serverId;
192     }
193
194     /**
195      * Gets the addressType
196      *
197      * @return the addressType
198      */

199     public int getAddressType() {
200         return addressType;
201     }
202
203     /**
204      * Sets the addressType
205      *
206      * @param the addressType
207      */

208     public void setAddressType(int addressType) {
209         this.addressType = addressType;
210     }
211
212     /**
213      * Gets the serverPassword
214      *
215      * @return the serverPassword
216      */

217     public String JavaDoc getServerPassword() {
218         return serverPassword;
219     }
220
221     /**
222      * Sets the serverPassword
223      *
224      * @param the serverPassword
225      */

226     public void setServerPassword(String JavaDoc serverPassword) {
227         this.serverPassword = serverPassword;
228     }
229
230     /**
231      * Gets the portNumber
232      *
233      * @return the portNumber
234      */

235     public int getPortNumber() {
236         return portNumber;
237     }
238
239     /**
240      * Sets the portNumber
241      *
242      * @param the portNumber
243      */

244     public void setPortNumber(int portNumber) {
245         this.portNumber = portNumber;
246     }
247
248     /**
249      * Gets the conRef
250      *
251      * @return the conRef
252      */

253     public String JavaDoc getConRef() {
254         return conRef;
255     }
256
257     /**
258      * Sets the conRef
259      *
260      * @param the conRef
261      */

262     public void setConRef(String JavaDoc conRef) {
263         this.conRef = conRef;
264     }
265
266     /**
267      * Gets the name
268      *
269      * @return the name
270      */

271     public String JavaDoc getName() {
272         return name;
273     }
274
275     /**
276      * Sets the name
277      *
278      * @param the name
279      */

280     public void setName(String JavaDoc name) {
281         this.name = name;
282     }
283
284
285     /**
286      * Gets the serverNonce
287      *
288      * @return the serverNonce
289      */

290     public byte[] getServerNonce() {
291         return serverNonce;
292     }
293
294     /**
295      * Sets the serverNonce
296      *
297      * @param the serverNonce
298      */

299     public void setServerNonce(byte[] serverNonce) {
300         this.serverNonce = serverNonce;
301     }
302
303     /**
304      * Sets the serverNonce
305      *
306      * @param the serverNonce
307      */

308     public void setServerNonce(String JavaDoc b64ServerNonce) {
309         this.serverNonce = Base64.decode(b64ServerNonce);
310     }
311
312     /**
313      * Gets the clientPassword
314      *
315      * @return the clientPassword
316      */

317     public String JavaDoc getClientPassword() {
318         return clientPassword;
319     }
320
321     /**
322      * Sets the clientPassword
323      *
324      * @param the clientPassword
325      */

326     public void setClientPassword(String JavaDoc clientPassword) {
327         this.clientPassword = clientPassword;
328     }
329
330     /**
331      * Gets the authPref
332      *
333      * @return the authPref
334      */

335     public String JavaDoc getAuthPref() {
336         return authPref;
337     }
338
339     /**
340      * Sets the authPref
341      *
342      * @param the authPref
343      */

344     public void setAuthPref(String JavaDoc authPref) {
345         this.authPref = authPref;
346     }
347
348
349
350 }
Popular Tags