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


001:        package com.sun.portal.app.wiki;
002:
003:        import javax.portlet.RenderRequest;
004:        import javax.portlet.RenderResponse;
005:        import javax.portlet.PortletSession;
006:        import java.util.*;
007:        import java.io.*;
008:
009:        public class WikiPortletContext {
010:
011:            static private ThreadLocal mapTL = new ThreadLocal();
012:
013:            static final String RENDER_REQUEST_KEY = "renderRequestKey";
014:            static final String RENDER_RESPONSE_KEY = "renderResponseKey";
015:
016:            static Properties props = new Properties();
017:
018:            static {
019:                try {
020:                    Properties psprops = new Properties();
021:                    InputStream is = ClassLoader
022:                            .getSystemResourceAsStream("PSConfig.properties");
023:                    if (is != null)
024:                        psprops.load(is);
025:
026:                    String instanceid = System
027:                            .getProperty("com.sun.portal.instance.id");
028:                    String portalid = System
029:                            .getProperty("com.sun.portal.portal.id");
030:                    String datadir = psprops.getProperty("ps.data.location");
031:                    String portaldatadir = datadir + "/portals/" + portalid;
032:
033:                    String log4j_appender_FileLog_File = portaldatadir
034:                            + "/logs/" + instanceid + "/jspwiki.log";
035:                    String jspwiki_workDir = portaldatadir + "/wiki/work";
036:                    String jspwiki_fileSystemProvider_pageDir = portaldatadir
037:                            + "/wiki/repository";
038:                    String jspwiki_basicAttachmentProvider_storageDir = portaldatadir
039:                            + "/wiki/repository";
040:
041:                    props.setProperty("jspwiki.workDir", jspwiki_workDir);
042:                    props.setProperty("jspwiki.fileSystemProvider.pageDir",
043:                            jspwiki_fileSystemProvider_pageDir);
044:                    props.setProperty(
045:                            "jspwiki.basicAttachmentProvider.storageDir",
046:                            jspwiki_basicAttachmentProvider_storageDir);
047:                    props.setProperty("log4j.appender.FileLog.File",
048:                            log4j_appender_FileLog_File);
049:
050:                } catch (Exception e) {
051:                    e.printStackTrace();
052:                }
053:            }
054:
055:            static public void init(RenderRequest request,
056:                    RenderResponse response) {
057:                mapTL.set(new HashMap());
058:                put(RENDER_REQUEST_KEY, request);
059:                put(RENDER_RESPONSE_KEY, response);
060:            }
061:
062:            static public void cleanup() {
063:                mapTL.set(null);
064:            }
065:
066:            static public Map getMap() {
067:                return (Map) mapTL.get();
068:            }
069:
070:            static public Properties getProperties() {
071:                return props;
072:            }
073:
074:            // this indicates whether a portlet context is active or not
075:            static public boolean isActive() {
076:                return mapTL.get() != null;
077:            }
078:
079:            // XXX never throw exception - return null (in case not setup, eg, add atachment)
080:            static public Object get(String key) {
081:                Map m = (Map) mapTL.get();
082:                if (m == null)
083:                    return null;
084:                return m.get(key);
085:            }
086:
087:            static public void put(String key, Object value) {
088:                Map m = (Map) mapTL.get();
089:                if (m == null)
090:                    return;
091:                ((Map) mapTL.get()).put(key, value);
092:            }
093:
094:            static public Object getPortletSessionAttribute(String name) {
095:                RenderRequest rreq = (RenderRequest) get(RENDER_REQUEST_KEY);
096:                if (rreq == null)
097:                    return null;
098:                return rreq.getPortletSession().getAttribute(name);
099:            }
100:
101:            static public void setPortletSessionAttribute(String name,
102:                    Object value) {
103:                RenderRequest rreq = (RenderRequest) get(RENDER_REQUEST_KEY);
104:                if (rreq == null)
105:                    return;
106:                rreq.getPortletSession().setAttribute(name, value);
107:            }
108:
109:            static public String getNamespace() {
110:                RenderResponse response = getRenderResponse();
111:                if (response != null)
112:                    return response.getNamespace();
113:                else
114:                    return null;
115:            }
116:
117:            static public RenderRequest getRenderRequest() {
118:                return (RenderRequest) get(RENDER_REQUEST_KEY);
119:            }
120:
121:            static public RenderResponse getRenderResponse() {
122:                return (RenderResponse) get(RENDER_RESPONSE_KEY);
123:            }
124:
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.