KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > auth > OnlineUser


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/auth/OnlineUser.java,v 1.21 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.21 $
5  * $Date: 2006/04/14 17:05:26 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Minh Nguyen
39  * @author: Mai Nguyen
40  */

41 package com.mvnforum.auth;
42
43 import java.sql.Timestamp JavaDoc;
44 import java.util.Locale JavaDoc;
45
46 import java.awt.image.BufferedImage JavaDoc;
47
48 import net.myvietnam.mvncore.exception.BadInputException;
49
50 public interface OnlineUser {
51
52     /**************************************************************
53      * Constants
54      **************************************************************/

55     public static final int AUTHENTICATION_TYPE_UNAUTHENTICATED = 0;
56
57     public static final int AUTHENTICATION_TYPE_HTML_FORM = 1;
58
59     public static final int AUTHENTICATION_TYPE_SESSION = 2;
60
61     public static final int AUTHENTICATION_TYPE_COOKIE = 3;
62
63     public static final int AUTHENTICATION_TYPE_REALM = 4;
64
65     public static final int AUTHENTICATION_TYPE_CUSTOMIZATION = 5;
66
67     /**************************************************************
68      * Methods
69      **************************************************************/

70     /**
71      * Get the numeric member id of this user
72      *
73      * @return int the numeric member id of this user
74      */

75     public int getMemberID();
76
77     /**
78      * Get the memberName that is used to login
79      *
80      * @return String the memberName that is used to login
81      */

82     public String JavaDoc getMemberName();
83
84     /**
85      * Check if this user is guest (not login yet) or already authenticated
86      *
87      * @return boolean true if this user is guest (not login yet)
88      */

89     public boolean isGuest();
90
91     /**
92      * Check if this user is already authenticated
93      *
94      * @return boolean true if this user is already authenticated
95      */

96     public boolean isMember();
97
98     /**
99      * Check if this user prefer the invisible mode
100      *
101      * @return boolean true if this user prefer the invisible mode
102      */

103     public boolean isInvisibleMember();
104
105     /**
106      * Get the authentication type that user did used to login
107      *
108      * @return int the authentication type
109      */

110     public int getAuthenticationType();
111
112     /**
113      * Get the permission that this user currently has
114      *
115      * @return MVNForumPermission
116      */

117     public MVNForumPermission getPermission();
118
119     /**
120      * Reload the permission from the underlying database
121      */

122     public void reloadPermission();
123
124     /**
125      * Reload the user's profile from the underlying database
126      */

127     public void reloadProfile();
128
129     /**
130      * Get the current action of this user in the system
131      *
132      * @return OnlineUserAction
133      */

134     public OnlineUserAction getOnlineUserAction();
135
136     public java.util.Date JavaDoc convertGMTDate(java.util.Date JavaDoc gmtDate);
137
138     public Timestamp JavaDoc convertGMTTimestamp(Timestamp JavaDoc gmtTimestamp);
139
140     public String JavaDoc getGMTDateFormat(java.util.Date JavaDoc gmtDate);
141
142     public String JavaDoc getGMTDateFormat(java.util.Date JavaDoc gmtDate, boolean adjustTimeZone);
143
144     public String JavaDoc getGMTTimestampFormat(Timestamp JavaDoc gmtTimestamp);
145
146     public String JavaDoc getGMTTimestampFormat(Timestamp JavaDoc gmtTimestamp, boolean adjustTimeZone);
147
148     /**
149      * Get the current locale of this user
150      *
151      * @return Locale the current locale of this user
152      */

153     public Locale JavaDoc getLocale();
154
155     /**
156      * Get the current locale name of this user
157      *
158      * @return String the current locale name of this user
159      */

160     public String JavaDoc getLocaleName();
161
162     /**
163      * Set the locale name for the current online user
164      * @param localeName String
165      */

166     public void setLocaleName(String JavaDoc localeName);
167
168     //public boolean getGender();
169

170     /**
171      * Get the timestampt of the last time this user login
172      *
173      * @return Timestamp
174      */

175     public Timestamp JavaDoc getLastLogonTimestamp();
176
177     /**
178      * Get the IP of the last time this user login
179      *
180      * @return String
181      */

182     public String JavaDoc getLastLogonIP();
183
184     /**
185      * Get the number of items that shown in one page for this user
186      *
187      * @return int the number of items that shown in one page
188      */

189     public int getPostsPerPage();
190
191     /**
192      * Get the number of new private messages of this user.
193      * @return int the number of new private messages of this user
194      */

195     public int getNewMessageCount();
196
197     /**
198      * Update the new message count value. The implementation
199      * should provide an effectively method if parameter force is false
200      * since this method is called many time.<p>
201      * In case force is true, update it immediately
202      * @return boolean values. It's true if the new message count
203      * greater than the current message count
204      */

205     public boolean updateNewMessageCount(boolean force);
206
207     /**
208      * Get the number of private messages that shown in one page for this user
209      *
210      * @return int the number of items that shown in one page
211      */

212     public int getMessagesPerPage();
213
214     /**
215      * Get the full ABSOLUTE path of the css file
216      *
217      * @return String the full ABSOLUTE path of the css file
218      */

219     public String JavaDoc getCssPath();
220
221     /**
222      * Get the full ABSOLUTE path of the logo file
223      *
224      * @return String the full ABSOLUTE path of the logo file
225      */

226     public String JavaDoc getLogoPath();
227
228     /**
229      * Build a new captcha, this method must be called before using some
230      * action that need captcha validation.
231      */

232     public void buildNewCaptcha();
233
234     /**
235      * Destroy the current captcha, this method must be called after validate
236      * the captcha
237      */

238     public void destroyCurrentCaptcha();
239
240     /**
241      * Get the captcha image to challenge the user
242      *
243      * @return BufferedImage the captcha image to challenge the user
244      */

245     public BufferedImage JavaDoc getCurrentCaptchaImage();
246
247     /**
248      * Validate the anwser of the captcha from user
249      *
250      * @param anwser String the captcha anwser from user
251      * @return boolean true if the answer is valid, otherwise return false
252      */

253     public boolean validateCaptchaResponse(String JavaDoc anwser);
254
255     /**
256      * Check to make sure that the captcha answer is correct
257      *
258      * @param answer String the captcha answer to check
259      * @throws BadInputException in case the captcha answer is not correct
260      */

261     public void ensureCorrectCaptchaResponse(String JavaDoc answer) throws BadInputException;
262
263     public void setCssPath(String JavaDoc path);
264
265     public void setLogoPath(String JavaDoc path);
266
267 }
268
Popular Tags