Source Code Cross Referenced for generic.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » authentication » sessionmanagers » databasedrivers » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.authentication.sessionmanagers.databasedrivers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: generic.java 3634 2007-01-08 21:42:24Z gbevin $
007:         */
008:        package com.uwyn.rife.authentication.sessionmanagers.databasedrivers;
009:
010:        import com.uwyn.rife.database.queries.*;
011:
012:        import com.uwyn.rife.authentication.ListSessions;
013:        import com.uwyn.rife.authentication.exceptions.SessionManagerException;
014:        import com.uwyn.rife.authentication.sessionmanagers.DatabaseSessions;
015:        import com.uwyn.rife.config.RifeConfig;
016:        import com.uwyn.rife.database.Datasource;
017:
018:        public class generic extends DatabaseSessions {
019:            protected CreateTable mCreateAuthentication = null;
020:            protected String mCreateAuthenticationSessStartIndex = null;
021:            protected Delete mPurgeSessions = null;
022:            protected Insert mStartSession = null;
023:            protected Select mIsSessionValid = null;
024:            protected Select mIsSessionValidRestrictHostIp = null;
025:            protected Update mContinueSession = null;
026:            protected Delete mEraseSession = null;
027:            protected Select mWasRemembered = null;
028:            protected Delete mEraseAllSessions = null;
029:            protected Delete mEraseUserSessions = null;
030:            protected DropTable mRemoveAuthentication = null;
031:            protected String mRemoveAuthenticationSessStartIndex = null;
032:            protected Select mCountSessions = null;
033:            protected Select mGetSessionUserId = null;
034:            protected Select mListSessions = null;
035:
036:            public generic(Datasource datasource) {
037:                super (datasource);
038:
039:                mCreateAuthentication = new CreateTable(getDatasource())
040:                        .table(
041:                                RifeConfig.Authentication
042:                                        .getTableAuthentication())
043:                        .column("authId", String.class, 32, CreateTable.NOTNULL)
044:                        .column("userId", long.class, CreateTable.NOTNULL)
045:                        .column("hostIp", String.class, 40, CreateTable.NOTNULL)
046:                        .column("sessStart", long.class, CreateTable.NOTNULL)
047:                        .column("remembered", boolean.class,
048:                                CreateTable.NOTNULL).defaultValue("remembered",
049:                                false).primaryKey(
050:                                RifeConfig.Authentication
051:                                        .getTableAuthentication().toUpperCase()
052:                                        + "_PK", "authId");
053:
054:                mCreateAuthenticationSessStartIndex = "CREATE INDEX "
055:                        + RifeConfig.Authentication.getTableAuthentication()
056:                        + "_IDX ON "
057:                        + RifeConfig.Authentication.getTableAuthentication()
058:                        + " (sessStart)";
059:
060:                mPurgeSessions = new Delete(getDatasource()).from(
061:                        mCreateAuthentication.getTable()).whereParameter(
062:                        "sessStart", "<=");
063:
064:                mStartSession = new Insert(getDatasource()).into(
065:                        mCreateAuthentication.getTable()).fieldParameter(
066:                        "authId").fieldParameter("userId").fieldParameter(
067:                        "hostIp").fieldParameter("sessStart").fieldParameter(
068:                        "remembered");
069:
070:                mIsSessionValid = new Select(getDatasource()).from(
071:                        mCreateAuthentication.getTable()).whereParameter(
072:                        "authId", "=").whereParameterAnd("sessStart", ">");
073:
074:                mIsSessionValidRestrictHostIp = new Select(getDatasource())
075:                        .from(mCreateAuthentication.getTable()).whereParameter(
076:                                "authId", "=").whereParameterAnd("hostIp", "=")
077:                        .whereParameterAnd("sessStart", ">");
078:
079:                mContinueSession = new Update(getDatasource()).table(
080:                        mCreateAuthentication.getTable()).fieldParameter(
081:                        "sessStart").whereParameter("authId", "=");
082:
083:                mEraseSession = new Delete(getDatasource()).from(
084:                        mCreateAuthentication.getTable()).whereParameter(
085:                        "authId", "=");
086:
087:                mWasRemembered = new Select(getDatasource()).from(
088:                        mCreateAuthentication.getTable()).field("remembered")
089:                        .whereParameter("authId", "=");
090:
091:                mEraseAllSessions = new Delete(getDatasource())
092:                        .from(mCreateAuthentication.getTable());
093:
094:                mEraseUserSessions = new Delete(getDatasource()).from(
095:                        mCreateAuthentication.getTable()).whereParameter(
096:                        "userId", "=");
097:
098:                mRemoveAuthentication = new DropTable(getDatasource())
099:                        .table(mCreateAuthentication.getTable());
100:
101:                mRemoveAuthenticationSessStartIndex = "DROP INDEX "
102:                        + RifeConfig.Authentication.getTableAuthentication()
103:                        + "_IDX";
104:
105:                mCountSessions = new Select(getDatasource()).field("count(*)")
106:                        .from(mCreateAuthentication.getTable()).whereParameter(
107:                                "sessStart", ">");
108:
109:                mGetSessionUserId = new Select(getDatasource()).field("userId")
110:                        .from(mCreateAuthentication.getTable()).whereParameter(
111:                                "authId", "=");
112:
113:                mListSessions = new Select(getDatasource()).from(
114:                        mCreateAuthentication.getTable()).whereParameter(
115:                        "sessStart", ">");
116:            }
117:
118:            public boolean install() throws SessionManagerException {
119:                return _install(mCreateAuthentication,
120:                        mCreateAuthenticationSessStartIndex);
121:            }
122:
123:            public boolean remove() throws SessionManagerException {
124:                return _remove(mRemoveAuthentication,
125:                        mRemoveAuthenticationSessStartIndex);
126:            }
127:
128:            public void purgeSessions() throws SessionManagerException {
129:                _purgeSessions(mPurgeSessions);
130:            }
131:
132:            public String startSession(long userId, String hostIp,
133:                    boolean remembered) throws SessionManagerException {
134:                return _startSession(mStartSession, userId, hostIp, remembered);
135:            }
136:
137:            public boolean isSessionValid(String authId, String hostIp)
138:                    throws SessionManagerException {
139:                return _isSessionValid(mIsSessionValid,
140:                        mIsSessionValidRestrictHostIp, authId, hostIp);
141:            }
142:
143:            public boolean continueSession(String authId)
144:                    throws SessionManagerException {
145:                return _continueSession(mContinueSession, authId);
146:            }
147:
148:            public boolean eraseSession(String authId)
149:                    throws SessionManagerException {
150:                return _eraseSession(mEraseSession, authId);
151:            }
152:
153:            public boolean wasRemembered(String authId)
154:                    throws SessionManagerException {
155:                return _wasRemembered(mWasRemembered, authId);
156:            }
157:
158:            public void eraseAllSessions() throws SessionManagerException {
159:                _eraseAllSessions(mEraseAllSessions);
160:            }
161:
162:            public boolean eraseUserSessions(long userId)
163:                    throws SessionManagerException {
164:                return _eraseUserSessions(mEraseUserSessions, userId);
165:            }
166:
167:            public long countSessions() throws SessionManagerException {
168:                return _countSessions(mCountSessions);
169:            }
170:
171:            public long getSessionUserId(String authId)
172:                    throws SessionManagerException {
173:                return _getSessionUserId(mGetSessionUserId, authId);
174:            }
175:
176:            public boolean listSessions(ListSessions processor)
177:                    throws SessionManagerException {
178:                return _listSessions(mListSessions, processor);
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.