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


001:        package com.sun.portal.app.filesharing.util;
002:
003:        import com.sun.portal.log.common.PortalLogger;
004:
005:        import javax.servlet.ServletContextListener;
006:        import javax.servlet.ServletContextEvent;
007:        import javax.servlet.http.HttpServletRequest;
008:        import javax.portlet.PortletRequest;
009:        import javax.faces.context.FacesContext;
010:        import java.util.logging.Logger;
011:        import javax.servlet.http.HttpServletResponse;
012:
013:        import com.sun.portal.community.CommunityFactory;
014:        import com.sun.portal.community.CommunityUser;
015:        import com.sun.portal.community.RoleId;
016:        import com.sun.portal.community.CommunityId;
017:
018:        import com.sun.portal.app.filesharing.repo.RepoFactory;
019:
020:        /**
021:         * @author Alejandro Abdelnur
022:         */
023:        public class WebAppInitializer implements  ServletContextListener {
024:
025:            private static final String MODE_INIT_PARAM = "app.mode";
026:            private static final String DELETE_ON_UNPROVISION_INIT_PARAM = "delete.on.unprovision";
027:
028:            public void contextInitialized(ServletContextEvent event) {
029:                String mode = event.getServletContext().getInitParameter(
030:                        MODE_INIT_PARAM);
031:                String s = event.getServletContext().getInitParameter(
032:                        DELETE_ON_UNPROVISION_INIT_PARAM);
033:                boolean unprovision = (s == null) ? false : "true"
034:                        .equalsIgnoreCase(s.trim());
035:
036:                if (mode == null || mode.equals("sunps")) {
037:                    LogUtils.setInstance(new PSLogUtils());
038:                    InfoResolverFactory
039:                            .setInstance(new CommunityInfoResolverFactory(
040:                                    unprovision));
041:                } else if (mode.equals("pluto")) {
042:                    LogUtils.setInstance(new JdkLogUtils());
043:                    InfoResolverFactory
044:                            .setInstance(new DummyInfoResolverFactory(
045:                                    unprovision));
046:                } else if (mode.equals("tomcat")) {
047:                    LogUtils.setInstance(new JdkLogUtils());
048:                    InfoResolverFactory
049:                            .setInstance(new DummyInfoResolverFactory(
050:                                    unprovision));
051:                } else {
052:                    throw new RuntimeException("Invalid application mode : "
053:                            + mode);
054:                }
055:            }
056:
057:            public void contextDestroyed(ServletContextEvent event) {
058:                LogUtils.setInstance(null);
059:            }
060:
061:            static class JdkLogUtils extends LogUtils {
062:
063:                public Logger getLogger(String name) {
064:                    return Logger.getLogger(name);
065:                }
066:
067:                public Logger getLogger(Class klass) {
068:                    return Logger.getLogger(klass.getName());
069:                }
070:
071:            }
072:
073:            private static class PSLogUtils extends LogUtils {
074:
075:                public Logger getLogger(String name) {
076:                    return PortalLogger.getLogger(name);
077:                }
078:
079:                public Logger getLogger(Class klass) {
080:                    return PortalLogger.getLogger(klass);
081:                }
082:
083:            }
084:
085:            private static class DummyInfoResolverFactory extends
086:                    InfoResolverFactory implements  InfoResolver {
087:                private boolean _unprovision;
088:
089:                private DummyInfoResolverFactory(boolean unprovision) {
090:                    _unprovision = unprovision;
091:                }
092:
093:                public InfoResolver getInfoResolver(PortletRequest req)
094:                        throws SecurityException {
095:                    return this ;
096:                }
097:
098:                public InfoResolver getInfoResolver(HttpServletRequest req)
099:                        throws SecurityException {
100:                    return this ;
101:                }
102:
103:                public InfoResolver getInfoResolver(HttpServletRequest req,
104:                        HttpServletResponse res) throws SecurityException {
105:                    return this ;
106:                }
107:
108:                public InfoResolver getInfoResolver(FacesContext context)
109:                        throws SecurityException {
110:                    return this ;
111:                }
112:
113:                public String getUserId() {
114:                    return "dummyUser";
115:                }
116:
117:                public String getSessionId() {
118:                    return null;
119:                }
120:
121:                public boolean getUnprovision() {
122:                    return _unprovision;
123:                }
124:
125:                public String getSearchServerURL() {
126:                    return "dummySearchServerURL";
127:                }
128:
129:                public String getSearchDatabase() {
130:                    return "dummySearchDatabase";
131:                }
132:
133:                public String getPreference(String name) {
134:                    return "dummy" + name;
135:                }
136:
137:                public String getRepositoryId() {
138:                    return "dummyRepository";
139:                }
140:
141:                public boolean isRepositoryOwner() {
142:                    return true;
143:                }
144:
145:                public boolean isDownloadAllow() {
146:                    return true;
147:                }
148:
149:            }
150:
151:            private class CommunityInfoResolverFactory extends
152:                    InfoResolverFactory {
153:                private boolean _unprovision;
154:
155:                private CommunityInfoResolverFactory(boolean unprovision) {
156:                    _unprovision = unprovision;
157:                }
158:
159:                private InfoResolver getInfoResolver(Object req)
160:                        throws SecurityException {
161:                    InfoResolver resolver = new CommunityInfoResolver(req,
162:                            _unprovision);
163:                    return resolver;
164:                }
165:
166:                public InfoResolver getInfoResolver(HttpServletRequest req,
167:                        HttpServletResponse res) throws SecurityException {
168:                    InfoResolver resolver = new CommunityInfoResolver(req, res,
169:                            _unprovision);
170:                    return resolver;
171:                }
172:
173:                public InfoResolver getInfoResolver(PortletRequest req)
174:                        throws SecurityException {
175:                    return getInfoResolver((Object) req);
176:                }
177:
178:                public InfoResolver getInfoResolver(HttpServletRequest req)
179:                        throws SecurityException {
180:                    return getInfoResolver((Object) req);
181:
182:                }
183:
184:                public InfoResolver getInfoResolver(FacesContext context) {
185:                    return getInfoResolver(context.getExternalContext()
186:                            .getRequest());
187:                }
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.