Source Code Cross Referenced for DSAMEDPUserContext.java in  » Portal » Open-Portal » com » sun » portal » desktop » context » 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 » Portal » Open Portal » com.sun.portal.desktop.context 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved. 
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms. 
004:         */
005:        package com.sun.portal.desktop.context;
006:
007:        import java.util.Set;
008:        import java.util.Map;
009:        import java.util.HashMap;
010:        import com.iplanet.sso.SSOToken;
011:        import javax.servlet.http.HttpServletRequest;
012:
013:        public class DSAMEDPUserContext implements  DPUserContext,
014:                DSAMEConstants {
015:
016:            protected DSAMEConnection dsameConn = null;
017:            protected Map dpDocumentsLastRead = new HashMap();
018:            protected long dpUserDocumentLastRead = -1;
019:
020:            private DesktopAppContext dac = null;
021:
022:            private static DSAMEMultiPortalConstants dmpc = DSAMEMultiPortalConstants
023:                    .getInstance();
024:
025:            public DSAMEDPUserContext() {
026:                dac = DesktopAppContextThreadLocalizer.get();
027:            }
028:
029:            public synchronized void init(SSOToken ssoToken) {
030:                dsameConn = new DSAMEConnection(ssoToken);
031:            }
032:
033:            public synchronized void init(HttpServletRequest req) {
034:                dsameConn = new DSAMEConnection(req);
035:            }
036:
037:            public void init(HttpServletRequest req, String uid, String pw) {
038:                dsameConn = new DSAMEConnection(uid, pw);
039:            }
040:
041:            public byte[] getDPUserDocument() {
042:                byte[] userDP = dsameConn
043:                        .getAttributeByteArrayFromROC(dmpc.MP_ATTR_DP_DOCUMENT_USER);
044:                setDPUserDocumentLastRead();
045:
046:                return userDP;
047:            }
048:
049:            protected void setDPUserDocumentLastModified() {
050:                dsameConn.setAttribute(dmpc.MP_ATTR_DP_LAST_MODIFIED_USER, Long
051:                        .toString(System.currentTimeMillis()));
052:            }
053:
054:            public void storeDPUserDocument(String dp) {
055:                if (dp != null) {
056:                    dsameConn.setAttribute(dmpc.MP_ATTR_DP_DOCUMENT_USER, dp);
057:                    setDPUserDocumentLastModified();
058:
059:                    //
060:                    // when we set the user document, it is assumed 
061:                    // we have the latest copy so set the last
062:                    // read AFTER we set the last modified, to make 
063:                    // sure we don't fool apps into re-reading just because
064:                    // they set the value
065:                    //
066:                    setDPUserDocumentLastRead();
067:                }
068:            }
069:
070:            public Set getDPDocumentNames() {
071:                Set names = dsameConn.getNodeNamesFromROC();
072:                return names;
073:            }
074:
075:            protected void setDPUserDocumentLastRead() {
076:                long lastRead = System.currentTimeMillis();
077:                dpUserDocumentLastRead = lastRead;
078:            }
079:
080:            protected void setDPDocumentLastRead(String name) {
081:                Long l = new Long(System.currentTimeMillis());
082:                dpDocumentsLastRead.put(name, l);
083:            }
084:
085:            public String getDPDocument(String name) {
086:                if (!dsameConn.isGlobal(name)) {
087:                    boolean isDesktopServiceAssigned = dsameConn
088:                            .isServiceAssigned(name,
089:                                    dmpc.MP_SUN_DESKTOP_SERVICE);
090:                    if (!isDesktopServiceAssigned) {
091:                        throw new ContextError(
092:                                "DSAMEAdminDPContext.getDPDocument(): "
093:                                        + "DesktopService not assigned to this dn : "
094:                                        + name);
095:                    }
096:                }
097:                String d = dsameConn.getAttributeByDNFromROC(name,
098:                        ATTR_DP_DOCUMENT);
099:                setDPDocumentLastRead(name);
100:
101:                return d;
102:            }
103:
104:            public long getDPDocumentLastModified(String name) {
105:                String lm = dsameConn.getAttributeByDNFromROC(name,
106:                        ATTR_DP_LAST_MODIFIED);
107:                //debugError("DSAMEDPContext.getDPDocumentLastModified(): name=" + name + ", lm=" + lm);
108:                long lastModified;
109:
110:                if (lm == null) {
111:                    //throw new ContextError("DSAMEDPContext.getDPDocumentLastModified(): could not get last modified value for name=" + name);
112:                    //
113:                    // TBD(jtb): is this an error?
114:                    //
115:                    lastModified = -1;
116:                } else {
117:                    try {
118:                        lastModified = Long.parseLong(lm);
119:                    } catch (NumberFormatException nfe) {
120:                        lastModified = -1;
121:                    }
122:                }
123:
124:                return lastModified;
125:            }
126:
127:            public long getDPUserDocumentLastModified() {
128:                String lm = dsameConn
129:                        .getAttributeFromROC(dmpc.MP_ATTR_DP_LAST_MODIFIED_USER);
130:                long lastModified;
131:
132:                if (lm == null) {
133:                    //
134:                    // TBD(jtb): is this an error?
135:                    //
136:                    lastModified = -1;
137:                } else {
138:                    try {
139:                        lastModified = Long.parseLong(lm);
140:                    } catch (NumberFormatException nfe) {
141:                        lastModified = -1;
142:                    }
143:                }
144:
145:                return lastModified;
146:            }
147:
148:            public long getDPUserDocumentLastRead() {
149:                return dpUserDocumentLastRead;
150:            }
151:
152:            public long getDPDocumentLastRead(String name) {
153:                Long l = (Long) dpDocumentsLastRead.get(name);
154:                long lastRead = -1;
155:                if (l != null) {
156:                    lastRead = l.longValue();
157:                }
158:                return lastRead;
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.