Source Code Cross Referenced for AbstractWikiMembers.java in  » Wiki-Engine » VeryQuickWiki » vqwiki » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Wiki Engine » VeryQuickWiki » vqwiki 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * @author garethc
003:         *  22/10/2002 13:20:38
004:         */package vqwiki;
005:
006:        import java.util.Random;
007:        import java.util.ResourceBundle;
008:        import java.net.MalformedURLException;
009:        import javax.servlet.http.HttpServletRequest;
010:        import org.apache.log4j.Logger;
011:        import vqwiki.servlets.WikiServlet;
012:        import vqwiki.utils.JSPUtils;
013:        import vqwiki.utils.Utilities;
014:
015:        public abstract class AbstractWikiMembers implements  WikiMembers {
016:
017:            protected String virtualWiki;
018:            private static final Logger logger = Logger
019:                    .getLogger(AbstractWikiMembers.class);
020:            private static final int KEY_LENGTH = 20;
021:            private static Random rn = new Random();
022:
023:            /**
024:             * Confirms a member (that is, gives them the ability to set notifications and reminders)
025:             * if the supplied key matches the key generated when the account was created. It is expected
026:             * that another class or JSP page will call this function at the request of a user.
027:             *
028:             * @param username  the name of the user to confirm
029:             * @param key the key to compare to the key generated when the account was created
030:             * @return boolean  True if the user is in the list.
031:             */
032:            public boolean confirmMembership(String username, String key)
033:                    throws Exception {
034:                WikiMember aMember = findMemberByName(username);
035:                logger.debug("Confirming membership by key " + key + " for "
036:                        + aMember);
037:                if (aMember.isConfirmed())
038:                    return true;
039:                return false;
040:            }
041:
042:            /**
043:             * Send the confirmation email to the member
044:             */
045:            protected void mailMember(String username,
046:                    HttpServletRequest request, WikiMember aMember, String email) {
047:                ResourceBundle messages = ResourceBundle.getBundle(
048:                        "ApplicationResources", request.getLocale());
049:                // Send an email to the requester with the generated key
050:                logger.debug("Sending email to " + email);
051:                StringBuffer buffer = new StringBuffer();
052:                buffer.append(username);
053:                buffer.append("\n");
054:                buffer.append(messages.getString("mail.confirmation.body"));
055:                buffer.append("\n\n");
056:                String wikiServerHostname = Environment.getInstance()
057:                        .getStringSetting(
058:                                Environment.PROPERTY_WIKI_SERVER_HOSTNAME);
059:                buffer.append(JSPUtils.createRootPath(request, virtualWiki,
060:                        wikiServerHostname));
061:                buffer.append("Wiki");
062:                buffer.append("?userName=");
063:                buffer.append(JSPUtils.encodeURL(username));
064:                buffer.append("&key=");
065:                buffer.append(aMember.getKey());
066:                buffer.append("&action=").append(WikiServlet.ACTION_MEMBER);
067:                WikiMail mailer = WikiMail.getInstance();
068:                String replyAddress = Environment.getInstance()
069:                        .getStringSetting(Environment.PROPERTY_REPLY_ADDRESS);
070:                mailer.sendMail(replyAddress, email, messages
071:                        .getString("mail.confirmation.subject"), buffer
072:                        .toString());
073:            }
074:
075:            /**
076:             * Create a new member with a random key
077:             */
078:            protected WikiMember createMember(String username, String email) {
079:                // Generate a key to confirm the request
080:                WikiMember aMember = new WikiMember(username, email);
081:                byte b[] = new byte[KEY_LENGTH];
082:                for (int i = 0; i < KEY_LENGTH; i++) {
083:                    b[i] = (byte) (rn.nextInt(26) + 65);
084:                }
085:                String newKey = new String(b);
086:                aMember.setKey(newKey);
087:                return aMember;
088:            }
089:        }
090:
091:        // $Log$
092:        // Revision 1.20  2006/04/24 18:07:18  studer
093:        // Just a small change for making bugfix http://www.vqwiki.org/jira/browse/VQW-72 perfect.
094:        //
095:        // Revision 1.19  2006/04/23 07:52:28  wrh2
096:        // Coding style updates (VQW-73).
097:        //
098:        // Revision 1.18  2006/04/22 07:39:36  studer
099:        // Fixing http://www.vqwiki.org/jira/browse/VQW-72
100:        //
101:        // Revision 1.17  2006/04/19 08:31:58  wrh2
102:        // Implement VQW-77 to remove hard-coding of action values.
103:        //
104:        // Revision 1.16  2006/04/12 21:01:56  studer
105:        // fix for http://www.vqwiki.org/jira/browse/VQW-72
106:        //
107:        // Revision 1.15  2006/04/11 21:43:18  mvdkleijn
108:        // fixes generation of confirmation link in email (VQW-72)
109:        //
110:        // Revision 1.14  2006/04/05 21:53:39  studer
111:        // Small fix for Tomcat 5 <> 5.5 incompatibility.
112:        //
113:        // Revision 1.13  2003/10/05 05:07:30  garethc
114:        // fixes and admin file encoding option + merge with contributions
115:        //
116:        // Revision 1.12  2003/09/21 20:52:43  garethc
117:        // merge and typos
118:        //
119:        // Revision 1.11  2003/05/14 19:02:58  mrgadget4711
120:        // MOD: Internationalization extended
121:        //
122:        // Revision 1.10  2003/04/28 03:54:41  garethc
123:        // beginning of work on import tool
124:        //
125:        // Revision 1.9  2003/04/15 23:10:57  garethc
126:        // lucene fixes
127:        //
128:        // Revision 1.8  2003/04/09 20:44:09  garethc
129:        // package org
130:        //
131:        // Revision 1.7  2003/02/18 20:48:07  garethc
132:        // 2.4.0 RC3
133:        //
134:        // Revision 1.6  2003/01/07 23:54:39  garethc
135:        // almost finished taglibs
136:        //
137:        // Revision 1.5  2003/01/07 03:11:51  garethc
138:        // beginning of big cleanup, taglibs etc
139:        //
140:        // Revision 1.4  2002/12/08 20:58:58  garethc
141:        // 2.3.6 almost ready
142:        //
143:        // Revision 1.3  2002/12/02 19:26:51  garethc
144:        // fixes
145:        //
146:        // Revision 1.2  2002/11/11 22:19:23  garethc
147:        // printable page
148:        //
149:        // Revision 1.1  2002/10/22 20:14:32  garethc
150:        // 2.2.0
151:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.