KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > planetamessenger > plugin > JUserInfo


1 /*
2     =========================================================================
3     Package plugin - Plugin management.
4
5     This module is developed and maintained by PlanetaMessenger.org.
6     Specs, New and updated versions can be found in
7     http://www.planetamessenger.org
8     If you want contact the Team please send a email to Project Manager
9     Leidson Campos Alves Ferreira at leidson@planetamessenger.org
10
11     Copyright (C) since 2001 by PlanetaMessenger.org
12     
13     This library is free software; you can redistribute it and/or
14     modify it under the terms of the GNU Lesser General Public
15     License as published by the Free Software Foundation; either
16     version 2.1 of the License, or (at your option) any later version.
17
18     This library is distributed in the hope that it will be useful,
19     but WITHOUT ANY WARRANTY; without even the implied warranty of
20     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21     Lesser General Public License for more details.
22
23     You should have received a copy of the GNU Lesser General Public
24     License along with this library; if not, write to the Free Software
25     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27     =========================================================================
28 */

29 /**
30  *
31  * $Id: JUserInfo.java,v 1.4 2007/01/28 17:39:21 popolony2k Exp $
32  * $Author: popolony2k $
33  * $Name: $
34  * $Revision: 1.4 $
35  * $State: Exp $
36  *
37  */

38
39 package org.planetamessenger.plugin;
40
41 import java.util.*;
42
43
44 public class JUserInfo {
45   
46   String JavaDoc strUserId;
47   String JavaDoc strPasswd;
48   String JavaDoc strAliasName;
49   int nLoginStatus;
50   short nAutoConnect;
51   HashMap hUserData;
52
53   
54   /**
55    * Constructor. Initializes all JUserInfo
56    * class data;
57    * @param strUserId The user id;
58    * @param strPasswd The User password;
59    * @param nLoginStatus The Plugin login status;
60    * @param nAutoConnect The Autoconnect status
61    * of this plugin;
62    */

63   public JUserInfo( String JavaDoc strUserId, String JavaDoc strAliasName, String JavaDoc strPasswd, int nLoginStatus, short nAutoConnect ) {
64     
65     this.strUserId = strUserId;
66     this.strAliasName = strAliasName;
67     this.strPasswd = strPasswd;
68     this.nLoginStatus = nLoginStatus;
69     this.nAutoConnect = nAutoConnect;
70     this.hUserData = new HashMap();
71   }
72   
73   /**
74    * Constructor. Initializes all JUserInfo
75    * class data;
76    * @param strUserId The user id;
77    * @param strPasswd The User password;
78    * @param nLoginStatus The Plugin login status;
79    */

80   public JUserInfo( String JavaDoc strUserId, String JavaDoc strAliasName, String JavaDoc strPasswd, int nLoginStatus ) {
81
82     this( strUserId, strAliasName, strPasswd, nLoginStatus, ( short ) 0 );
83   }
84   
85   /**
86    * Destroy the user data internal objects, invalidating
87    * the current User Info object.
88    */

89   public void destroy() {
90     
91     hUserData.clear();
92     hUserData = null;
93   }
94
95   /**
96    * Returns the UserId;
97    */

98   public String JavaDoc getUserId() {
99     
100     return strUserId;
101   }
102
103   /**
104    * Set the object password field.
105    * @param strPasswd The new password to set;
106    */

107   public void setPassword( String JavaDoc strPasswd ) {
108     
109     this.strPasswd = strPasswd;
110   }
111   
112   /**
113    * Returns the User password;
114    */

115   public String JavaDoc getPassword() {
116     
117     return strPasswd;
118   }
119
120   /**
121    * Set the login status for userInfo Object.<br>
122    * @param nLoginStatus The new user login status;<br>
123    */

124   public void setLoginStatus( int nLoginStatus ) {
125     
126     this.nLoginStatus = nLoginStatus;
127   }
128
129   /**
130    * Returns the user login status;
131    */

132   public int getLoginStatus() {
133     
134     return nLoginStatus;
135   }
136
137   /**
138    * Set the Autoconnect property.
139    */

140   public void setAutoconnect( short nAutoConnect ) {
141   
142     this.nAutoConnect = nAutoConnect;
143   }
144   
145   /**
146    * Returns the user plugin autcoconnect
147    * status.
148    */

149   public short getAutoConnect() {
150     
151     return nAutoConnect;
152   }
153   
154   /**
155    * Set the alias name for user info object;<br>
156    * @param strAliasName The user nick name;<br>
157    */

158   public void setAliasName( String JavaDoc strAliasName ) {
159     
160     this.strAliasName = strAliasName;
161   }
162     
163   /**
164    * Get the user alias name from user info object;<br>
165    */

166   public String JavaDoc getAliasName() {
167     
168     return ( strAliasName == null ? strUserId : strAliasName );
169   }
170   
171   /**
172    * Add specific user data.
173    * @param objKey The key used to retrieve the stored object;
174    * @param objData The Data to be stored;
175    */

176   public void addUserData( Object JavaDoc objKey, Object JavaDoc objData ) {
177     
178     hUserData.put( objKey, objData );
179   }
180   
181   /**
182    * Retrieve the user data to given key;
183    * @param objKey The key to retrieve object;
184    */

185   public Object JavaDoc getUserData( Object JavaDoc objKey ) {
186     
187     return hUserData.get( objKey );
188   }
189 }
190
191 // JUserInfo class
192
Popular Tags