Source Code Cross Referenced for WebserviceSSOSessionManager.java in  » Authentication-Authorization » josso-1.7 » org » josso » gateway » session » service » ws » 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 » Authentication Authorization » josso 1.7 » org.josso.gateway.session.service.ws 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOSSO: Java Open Single Sign-On
003:         *
004:         * Copyright 2004-2008, Atricore, Inc.
005:         *
006:         * This is free software; you can redistribute it and/or modify it
007:         * under the terms of the GNU Lesser General Public License as
008:         * published by the Free Software Foundation; either version 2.1 of
009:         * the License, or (at your option) any later version.
010:         *
011:         * This software is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this software; if not, write to the Free
018:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
020:         */
021:        package org.josso.gateway.session.service.ws;
022:
023:        import org.apache.commons.logging.Log;
024:        import org.apache.commons.logging.LogFactory;
025:        import org.josso.gateway.session.SSOSession;
026:        import org.josso.gateway.session.exceptions.NoSuchSessionException;
027:        import org.josso.gateway.session.exceptions.SSOSessionException;
028:        import org.josso.gateway.session.service.SSOSessionManager;
029:        import org.josso.gateway.session.service.SessionIdGenerator;
030:        import org.josso.gateway.session.service.MutableBaseSession;
031:        import org.josso.gateway.session.service.store.SessionStore;
032:        import org.josso.gateway.assertion.exceptions.AssertionNotValidException;
033:
034:        import java.rmi.RemoteException;
035:        import java.util.Collection;
036:
037:        /**
038:         * Webservice client implementation for the SSO Session Manager based on
039:         * the Axis-generated Stub & Skeleton.
040:         *
041:         * @author <a href="mailto:gbrigand@josso.org">Gianluca Brigandi</a> 
042:         * @version CVS $Id: WebserviceSSOSessionManager.java 508 2008-02-18 13:32:29Z sgonzalez $
043:         */
044:
045:        public class WebserviceSSOSessionManager implements 
046:                org.josso.gateway.session.service.SSOSessionManager {
047:            private static final Log logger = LogFactory
048:                    .getLog(SSOSessionManager.class);
049:
050:            private org.josso.gateway.session.service.ws.impl.SSOSessionManager _wsSSOSessionManager;
051:
052:            private long _processedCount;
053:            private long _errorCount;
054:
055:            /**
056:             * Build a Webservice SSO Session Manager.
057:             *
058:             * @param wsSSOSessionManager the SOAP stub to be invoked.
059:             */
060:            public WebserviceSSOSessionManager(
061:                    org.josso.gateway.session.service.ws.impl.SSOSessionManager wsSSOSessionManager) {
062:                _wsSSOSessionManager = wsSSOSessionManager;
063:            }
064:
065:            /**
066:             * Initiates a new session. The session id is returned.
067:             *
068:             * @return the new session identifier.
069:             */
070:            public String initiateSession(String username)
071:                    throws SSOSessionException {
072:                try {
073:                    return _wsSSOSessionManager.initiateSession(username);
074:                } catch (java.rmi.RemoteException e) {
075:                    _errorCount++;
076:                    throw new SSOSessionException(e.getMessage(), e);
077:                } finally {
078:                    _processedCount++;
079:                }
080:            }
081:
082:            /**
083:             * This method accesss the session associated to the received id.
084:             * This resets the session last access time and updates the access count.
085:             *
086:             * @param sessionId the session id previously returned by initiateSession.
087:             * @throws org.josso.gateway.session.exceptions.NoSuchSessionException if the session id is not related to any sso session.
088:             */
089:            public void accessSession(String sessionId)
090:                    throws NoSuchSessionException, SSOSessionException {
091:
092:                try {
093:                    _wsSSOSessionManager.accessSession(sessionId);
094:                } catch (org.josso.gateway.session.service.ws.impl.NoSuchSessionException e) {
095:                    throw new org.josso.gateway.session.exceptions.NoSuchSessionException(
096:                            e.getMessage());
097:
098:                } catch (java.rmi.RemoteException e) {
099:                    _errorCount++;
100:                    throw new SSOSessionException(e.getMessage(), e);
101:                } finally {
102:                    _processedCount++;
103:                }
104:
105:            }
106:
107:            /**
108:             * Gets an SSO session based on its id.
109:             *
110:             * @param sessionId the session id previously returned by initiateSession.
111:             * @throws org.josso.gateway.session.exceptions.NoSuchSessionException if the session id is not related to any sso session.
112:             */
113:            public SSOSession getSession(String sessionId)
114:                    throws NoSuchSessionException, SSOSessionException {
115:
116:                try {
117:                    return adaptSSOSession(_wsSSOSessionManager
118:                            .getSession(sessionId));
119:                } catch (org.josso.gateway.session.service.ws.impl.NoSuchSessionException e) {
120:                    throw new org.josso.gateway.session.exceptions.NoSuchSessionException(
121:                            e.getMessage());
122:
123:                } catch (java.rmi.RemoteException e) {
124:                    _errorCount++;
125:                    throw new SSOSessionException(e.getMessage(), e);
126:                } finally {
127:                    _processedCount++;
128:                }
129:
130:            }
131:
132:            /**
133:             * Gets all SSO sessions.
134:             */
135:            public Collection getSessions() throws SSOSessionException {
136:                throw new UnsupportedOperationException(
137:                        "Not supported by this implementation");
138:            }
139:
140:            /**
141:             * Gets an SSO session based on the associated user.
142:             *
143:             * @param username the username used when initiating the session.
144:             * @throws org.josso.gateway.session.exceptions.NoSuchSessionException if the session id is not related to any sso session.
145:             */
146:            public Collection getUserSessions(String username)
147:                    throws NoSuchSessionException, SSOSessionException {
148:                throw new UnsupportedOperationException(
149:                        "Not supported by this implementation");
150:            }
151:
152:            /**
153:             * Invalidates all sessions, (not supported)
154:             *
155:             */
156:            public void invalidateAll() throws SSOSessionException {
157:                throw new UnsupportedOperationException(
158:                        "Not supported by this implementation");
159:            }
160:
161:            /**
162:             * Invalidates a session.
163:             *
164:             * @param sessionId the session id previously returned by initiateSession.
165:             * @throws org.josso.gateway.session.exceptions.NoSuchSessionException if the session id is not related to any sso session.
166:             */
167:            public void invalidate(String sessionId)
168:                    throws NoSuchSessionException, SSOSessionException {
169:
170:                try {
171:                    _wsSSOSessionManager.invalidate(sessionId);
172:                } catch (java.rmi.RemoteException e) {
173:                    _errorCount++;
174:                    throw new SSOSessionException(e.getMessage(), e);
175:                } finally {
176:                    _processedCount++;
177:                }
178:
179:            }
180:
181:            /**
182:             * Check all sessions and remove those that are not valid from the store.
183:             * This method is invoked periodically to update sessions state.
184:             */
185:            public void checkValidSessions() {
186:
187:                try {
188:                    _wsSSOSessionManager.checkValidSessions();
189:                } catch (java.rmi.RemoteException e) {
190:                    _errorCount++;
191:                } finally {
192:                    _processedCount++;
193:                }
194:
195:            }
196:
197:            /**
198:             * For compatibility only
199:             */
200:            public void initialize() {
201:            }
202:
203:            /**
204:             * For compatibility only
205:             */
206:            public void setSessionStore(SessionStore ss) {
207:                throw new UnsupportedOperationException(
208:                        "Not supporte by this implementation");
209:            }
210:
211:            /**
212:             * For compatibility only
213:             */
214:            public void setSessionIdGenerator(SessionIdGenerator g) {
215:                throw new UnsupportedOperationException(
216:                        "Not supported by this implementation");
217:            }
218:
219:            public int getSessionCount() throws SSOSessionException {
220:                try {
221:                    return _wsSSOSessionManager.getSessionCount();
222:                } catch (RemoteException e) {
223:                    throw new SSOSessionException(e.getMessage(), e);
224:                }
225:            }
226:
227:            public long getErrorCount() {
228:                return _errorCount;
229:            }
230:
231:            public long getProcessedCount() {
232:                return _processedCount;
233:            }
234:
235:            /**
236:             * Maps a SOAP SSOSession type instance to a JOSSO SSOSession type instance.
237:             *
238:             * @param srcSSOSession the SOAP type instance to be mapped.
239:             * @return the mapped session
240:             */
241:            protected org.josso.gateway.session.SSOSession adaptSSOSession(
242:                    org.josso.gateway.session.service.ws.impl.SSOSession srcSSOSession) {
243:
244:                MutableBaseSession targetSSOSession = new MutableBaseSession();
245:
246:                targetSSOSession.setId(srcSSOSession.getId());
247:                targetSSOSession.setCreationTime(srcSSOSession
248:                        .getCreationTime());
249:                targetSSOSession.setLastAccessedTime(srcSSOSession
250:                        .getLastAccessTime());
251:                targetSSOSession.setMaxInactiveInterval(srcSSOSession
252:                        .getMaxInactiveInterval());
253:                targetSSOSession.setUsername(srcSSOSession.getUsername());
254:                targetSSOSession.setAccessCount(srcSSOSession.getAccessCount());
255:
256:                return targetSSOSession;
257:
258:            }
259:
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.